mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Move all new strings to YAML, basic working Matrix backend with text messages
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# ==================================== #
|
||||
# WinDog multi-purpose chatbot #
|
||||
# Licensed under AGPLv3 by OctoSpacc #
|
||||
# ==================================== #
|
||||
# ================================== #
|
||||
# WinDog multi-purpose chatbot #
|
||||
# Licensed under AGPLv3 by OctoSpacc #
|
||||
# ================================== #
|
||||
|
||||
def cSource(context:EventContext, data:InputMessageData) -> None:
|
||||
SendMessage(context, {"TextPlain": ("""\
|
||||
@ -28,7 +28,10 @@ def cConfig(context:EventContext, data:InputMessageData) -> None:
|
||||
# ... userdata: import, export, delete
|
||||
|
||||
def cPing(context:EventContext, data:InputMessageData) -> None:
|
||||
SendMessage(context, {"Text": "*Pong!*"})
|
||||
# nice experiment, but it won't work with Telegram since time is not to milliseconds (?)
|
||||
#time_diff = (time_now := int(time.time())) - (time_sent := data.datetime)
|
||||
#SendMessage(context, OutputMessageData(text_html=f"<b>Pong!</b>\n\n{time_sent} → {time_now} = {time_diff}"))
|
||||
SendMessage(context, OutputMessageData(text_html="<b>Pong!</b>"))
|
||||
|
||||
#def cTime(update:Update, context:CallbackContext) -> None:
|
||||
# update.message.reply_markdown_v2(
|
||||
@ -39,12 +42,12 @@ def cEval(context:EventContext, data:InputMessageData) -> None:
|
||||
SendMessage(context, {"Text": choice(Locale.__('eval'))})
|
||||
|
||||
RegisterModule(name="Base", endpoints=[
|
||||
SafeNamespace(names=["source"], summary="Provides a copy of the bot source codes and/or instructions on how to get it.", handler=cSource),
|
||||
SafeNamespace(names=["source"], handler=cSource),
|
||||
SafeNamespace(names=["config"], handler=cConfig, arguments={
|
||||
"get": True,
|
||||
}),
|
||||
#SafeNamespace(names=["gdpr"], summary="Operations for european citizens regarding your personal data.", handler=cGdpr),
|
||||
SafeNamespace(names=["ping"], summary="Responds pong, useful for testing messaging latency.", handler=cPing),
|
||||
SafeNamespace(names=["ping"], handler=cPing),
|
||||
#SafeNamespace(names=["eval"], summary="Execute a Python command (or safe literal operation) in the current context. Currently not implemented.", handler=cEval),
|
||||
#SafeNamespace(names=["format"], summary="Reformat text using an handful of rules. Not yet implemented.", handler=cFormat),
|
||||
#SafeNamespace(names=["frame"], summary="Frame someone's message into a platform-styled image. Not yet implemented.", handler=cFrame),
|
||||
|
Reference in New Issue
Block a user