Add long helps for some commands

This commit is contained in:
gammafn 2021-04-12 14:39:23 -05:00
parent 4e1787aa14
commit 86b1144b8c
5 changed files with 43 additions and 4 deletions

View File

@ -51,5 +51,17 @@ class MatrixModule(BotModule):
msg = '\n'.join([ f'- {key} => {val}' for key, val in bot.module_aliases.items() ])
await bot.send_text(room, 'Aliases:\n' + msg)
if args.pop(0) == 'help':
await bot.send_text(room, self.long_help(bot=bot, event=event))
def help(self):
return 'Alias a command'
return 'Manage command aliases'
def long_help(self, bot=None, event=None, **kwargs):
text = self.help() + (
'\n- "!alias (list|ls)": list defined aliases'
'\n- "!alias help": show this help')
if bot and event and bot.is_owner(event):
text += ('\n- "!alias (remove|rm) [name]": remove an alias'
'\n- "!alias add [name] [command]": add an alias for [command]')
return text

View File

@ -174,3 +174,16 @@ class MatrixModule(BotModule):
def help(self):
return 'Bot management commands. (quit, version, reload, status, stats, leave, modules, enable, disable)'
def long_help(self, bot=None, event=None, **kwargs):
text = self.help() + (
'\n- "!bot version": get bot version'
'\n- "!bot status": get bot uptime and status'
'\n- "!bot stats": get current users, rooms, and homeservers')
if bot and event and bot.is_owner(event):
text += ('\n- "!bot quit": kill the bot :('
'\n- "!bot reload": reload the bot modules'
'\n- "!bot enable [module]": enable a module'
'\n- "!bot disable [module]": disable a module')
return text

View File

@ -43,9 +43,6 @@ class MatrixModule(BotModule):
if len(args) > 1:
if args.pop(0) == '!sethelp':
bot.must_be_owner(event)
msg = ''
modulename = args.pop(0)
moduleobject = bot.modules.get(modulename)

View File

@ -20,6 +20,14 @@ class MatrixModule(BotModule):
def help(self):
return "Commands for interacting with the current room "
def long_help(self, **kwargs):
return self.help() + (
'\n- "!room servers": List all servers in the current room'
'\n- "!room joined": Count how many users are in the current room'
'\n- "!room banned": List all users banned from the current room and the provided reason'
'\n- "!room kicked": List all users kicked from the current room and the provided reason'
'\n- "!room state [event_type] [[state_key]]": Get a state event (state_key optional)')
async def matrix_message(self, bot, room, event):
args = event.body.split()
args.pop(0)

View File

@ -119,3 +119,12 @@ class MatrixModule(BotModule):
def help(self):
return ('Wolfram Alpha search')
def long_help(self, bot=None, event=None, **kwargs):
text = self.help() + (
'\n- "!wa [query]": Query WolframAlpha and return the primary pod'
'\n- "!wafull [query]": Query WolframAlpha and return all pods'
)
if bot and event and bot.is_owner(event):
text += '\n- "!wa appid [appid]": Set appid'
return text