Legacy removals, code restructuring, add send_... functions and better help

This commit is contained in:
2024-08-10 01:36:54 +02:00
parent 183b8c60cd
commit 6ebc68127e
32 changed files with 512 additions and 351 deletions

View File

@ -3,9 +3,9 @@
# Licensed under AGPLv3 by OctoSpacc #
# ==================================== #
def cEcho(context:EventContext, data:InputMessageData) -> None:
if not (text := ObjGet(data, "command.body")):
return SendMessage(context, {
def cEcho(context:EventContext, data:InputMessageData):
if not (text := data.command.body):
return send_message(context, {
"text_html": context.endpoint.get_string("empty", data.user.settings.language)})
prefix = f'<a href="{data.message_url}">🗣️</a> '
if len(data.command.tokens) == 2: # text is a single word
@ -18,7 +18,7 @@ def cEcho(context:EventContext, data:InputMessageData) -> None:
# 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))})
return send_message(context, {"text_html": (prefix + html_escape(text))})
RegisterModule(name="Echo", endpoints=[
SafeNamespace(names=["echo"], handler=cEcho, body=True),