mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Legacy removals, code restructuring, add send_... functions and better help
This commit is contained in:
@ -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),
|
||||
|
Reference in New Issue
Block a user