mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Cleanup Locale system, remove legacy Locale API, add command help handling, misc
This commit is contained in:
@ -5,21 +5,22 @@
|
||||
|
||||
def cEcho(context:EventContext, data:InputMessageData) -> None:
|
||||
if not (text := ObjGet(data, "command.body")):
|
||||
return SendMessage(context, {"text_html": context.endpoint.get_string("empty", data.user.settings.language)})
|
||||
return SendMessage(context, {
|
||||
"text_html": context.endpoint.get_string("empty", data.user.settings.language)})
|
||||
prefix = f'<a href="{data.message_url}">🗣️</a> '
|
||||
#prefix = f"[🗣️]({context.linker(data).message}) "
|
||||
if len(data.command.tokens) == 2:
|
||||
if len(data.command.tokens) == 2: # text is a single word
|
||||
nonascii = True
|
||||
for char in data.command.tokens[1]:
|
||||
if ord(char) < 256:
|
||||
nonascii = False
|
||||
break
|
||||
if nonascii:
|
||||
# text is not ascii, probably an emoji (altough not necessarily), so just pass as is (useful for Telegram emojis)
|
||||
# word is not ascii, probably an emoji (altough not necessarily)
|
||||
# so just pass it as is (useful for Telegram emojis)
|
||||
prefix = ''
|
||||
SendMessage(context, {"text_html": (prefix + html_escape(text))})
|
||||
|
||||
RegisterModule(name="Echo", endpoints=[
|
||||
SafeNamespace(names=["echo"], handler=cEcho),
|
||||
SafeNamespace(names=["echo"], handler=cEcho, body=True),
|
||||
])
|
||||
|
||||
|
Reference in New Issue
Block a user