Compare commits

...

2 commits

Author SHA1 Message Date
7496c43161 fix: match command correctly 2026-05-21 16:17:14 -04:00
c000d75111 fix: add EXT_SOURCE constant 2026-05-21 16:14:30 -04:00

View file

@ -5,7 +5,8 @@ EXT_NAME = "endcord_aemoji"
EXT_VERSION = "0.1.0" EXT_VERSION = "0.1.0"
EXT_ENDCORD_VERSION = "1.4.2" EXT_ENDCORD_VERSION = "1.4.2"
EXT_DESCRIPTION = "View animated custom emoji as GIFs" EXT_DESCRIPTION = "View animated custom emoji as GIFs"
EXT_COMMAND_ASSIST = ("view_aemoji - View animated emoji", "view_aemoji") EXT_SOURCE = "https://git.silvertke.net/SilverTke/endcord-aemoji"
EXT_COMMAND_ASSIST = (("view_aemoji - View animated emoji", "view_aemoji"),)
EMOJI_RE = re.compile("^<:(.+):(\d+)>$") EMOJI_RE = re.compile("^<:(.+):(\d+)>$")
@ -22,15 +23,19 @@ class Extension:
def __init__(self, app): def __init__(self, app):
self.app: Endcord = app self.app: Endcord = app
def on_execute_command(self, command_text: str, chat_sel: int, tree_sel: int): def on_execute_command(
self, command_text: str, chat_sel: int, tree_sel: int
) -> bool:
if command_text.startswith("view_aemoji"): if command_text.startswith("view_aemoji"):
try: try:
emoji = command_text.split(" ")[1] emoji = command_text.split(" ")[1]
except IndexError: except IndexError:
self.app.update_extra_line("Emoji argument not given") self.app.update_extra_line("Emoji argument not given")
return return True
emoji_url = get_emoji_url(emoji) emoji_url = get_emoji_url(emoji)
if emoji_url is None: if emoji_url is None:
self.app.update_extra_line("Invalid emoji") self.app.update_extra_line("Invalid emoji")
return return True
self.app.download_file(emoji_url, open_media=True) self.app.download_file(emoji_url, open_media=True)
return True
return False