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:
@@ -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={
|
||||
|
Reference in New Issue
Block a user