git » sdk » commit 89c9031

Helpers for making reactions to send

author Stephen Paul Weber
2025-09-16 20:41:12 UTC
committer Stephen Paul Weber
2025-09-16 20:41:12 UTC
parent b14ceb332c29c465543f3f25322ac2bee86fbea6

Helpers for making reactions to send

snikket/Reaction.hx +19 -0

diff --git a/snikket/Reaction.hx b/snikket/Reaction.hx
index e957417..3ce7a82 100644
--- a/snikket/Reaction.hx
+++ b/snikket/Reaction.hx
@@ -28,6 +28,15 @@ class Reaction {
 		this.key = key ?? this.text;
 	}
 
+	/**
+		Create a new Unicode reaction to send
+
+		@param unicode emoji of the reaction
+	**/
+	public static function unicode(unicode: String) {
+		return new Reaction("", "", unicode);
+	}
+
 	@:allow(snikket)
 	private function render<T>(forText: (String) -> T, forImage: (String, String) -> T) {
 		return forText(text + "\u{fe0f}");
@@ -48,6 +57,16 @@ class CustomEmojiReaction extends Reaction {
 		this.uri = uri;
 	}
 
+	/**
+		Create a new custom emoji reaction to send
+
+		@param text name of custom emoji
+		@param uri URI for media of custom emoji
+	**/
+	public static function custom(text: String, uri: String) {
+		return new CustomEmojiReaction("", "", text, uri);
+	}
+
 	@:allow(snikket)
 	override public function render<T>(forText: (String) -> T, forImage: (String, String) -> T) {
 		final hash = Hash.fromUri(uri);