Improve code structure, improve /help, /safebooru, /echo, add /lua

This commit is contained in:
2024-06-16 01:40:30 +02:00
parent b7eb53e6a7
commit d687cbd51e
19 changed files with 335 additions and 233 deletions

19
ModWinDog/Help.py Normal file
View File

@ -0,0 +1,19 @@
# TODO: implement /help <commandname> feature
def cHelp(context, data=None) -> None:
moduleList, commands = '', ''
for module in Modules:
summary = Modules[module]["summary"]
endpoints = Modules[module]["endpoints"]
moduleList += (f"\n\n{module}" + (f": {summary}" if summary else ''))
for endpoint in endpoints:
summary = endpoints[endpoint]["summary"]
moduleList += (f"\n* /{', /'.join(endpoints[endpoint]['names'])}" + (f": {summary}" if summary else ''))
for cmd in Endpoints.keys():
commands += f'* /{cmd}\n'
SendMsg(context, {"Text": f"[ Available Modules ]{moduleList}\n\nFull Endpoints List:\n{commands}"})
RegisterModule(name="Help", group="Basic", endpoints={
"Help": CreateEndpoint(["help"], summary="Provides help for the bot. For now, it just lists the commands.", handler=cHelp),
})