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

@@ -1,17 +1,19 @@
# ================================== #
# WinDog multi-purpose chatbot #
# Licensed under AGPLv3 by OctoSpacc #
# ================================== #
# ==================================== #
# WinDog multi-purpose chatbot #
# Licensed under AGPLv3 by OctoSpacc #
# ==================================== #
def cBroadcast(context:EventContext, data:InputMessageData) -> None:
def cBroadcast(context:EventContext, data:InputMessageData):
language = data.user.settings.language
if (data.user.id not in AdminIds) and (data.user.tag not in AdminIds):
return SendMessage(context, {"Text": "Permission denied."})
destination = data.command.arguments["destination"]
text = data.command.body
return send_status(context, 403, language)
destination = data.command.arguments.destination
text = (data.command.body or (data.quoted and data.quoted.text_plain))
if not (destination and text):
return SendMessage(context, OutputMessageData(text_plain="Bad usage."))
SendMessage(context, {"text_plain": text, "room": SafeNamespace(id=destination)})
SendMessage(context, {"text_plain": "Executed."})
return send_status_400(context, language)
result = send_message(context, {"text_plain": text, "room": SafeNamespace(id=destination)})
send_message(context, {"text_plain": "Executed."})
return result
RegisterModule(name="Broadcast", endpoints=[
SafeNamespace(names=["broadcast"], handler=cBroadcast, body=True, arguments={