2024-08-10 01:36:54 +02:00
|
|
|
# ==================================== #
|
|
|
|
# WinDog multi-purpose chatbot #
|
|
|
|
# Licensed under AGPLv3 by OctoSpacc #
|
|
|
|
# ==================================== #
|
2024-06-25 02:08:49 +02:00
|
|
|
|
2024-08-10 01:36:54 +02:00
|
|
|
def mMultifun(context:EventContext, data:InputMessageData):
|
2024-08-07 02:27:17 +02:00
|
|
|
reply_to = None
|
|
|
|
fun_strings = {}
|
|
|
|
for key in ("empty", "bot", "self", "others"):
|
|
|
|
fun_strings[key] = context.endpoint.get_string(key, data.user.settings.language)
|
2024-06-28 01:57:42 +02:00
|
|
|
if data.quoted:
|
2024-08-07 02:27:17 +02:00
|
|
|
if fun_strings["bot"] and (data.quoted.user.id == Platforms[context.platform].agent_info.id):
|
|
|
|
text = choice(fun_strings["bot"])
|
|
|
|
elif fun_strings["self"] and (data.quoted.user.id == data.user.id):
|
|
|
|
text = choice(fun_strings["self"]).format(data.user.name)
|
|
|
|
elif fun_strings["others"]:
|
|
|
|
text = choice(fun_strings["others"]).format(data.user.name, data.quoted.user.name)
|
|
|
|
reply_to = data.quoted.message_id
|
2024-06-25 02:08:49 +02:00
|
|
|
else:
|
2024-08-07 02:27:17 +02:00
|
|
|
if fun_strings["empty"]:
|
|
|
|
text = choice(fun_strings["empty"])
|
2024-08-10 01:36:54 +02:00
|
|
|
return send_message(context, {"text_html": text, "ReplyTo": reply_to})
|
2024-06-25 02:08:49 +02:00
|
|
|
|
2024-10-21 00:26:08 +02:00
|
|
|
register_module(name="Multifun", endpoints=[
|
2024-06-29 01:52:53 +02:00
|
|
|
SafeNamespace(names=["hug", "pat", "poke", "cuddle", "hands", "floor", "sessocto"], handler=mMultifun),
|
2024-06-25 02:08:49 +02:00
|
|
|
])
|
|
|
|
|