mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Rejig !commands to be less spammy
Commands are now organized per module, and full command sysnopsis is only given for a module at a time
This commit is contained in:
parent
85a7348571
commit
2c8ff697bd
4 changed files with 41 additions and 16 deletions
|
@ -59,15 +59,34 @@ def Commands(nick,chan,cmd):
|
|||
all = True
|
||||
else:
|
||||
all = False
|
||||
|
||||
module_name = GetParam(cmd,1)
|
||||
|
||||
SendTo(nick, "Commands for %s:" % config.tipbot_name)
|
||||
|
||||
msgs = dict()
|
||||
for command_name in commands:
|
||||
c = commands[command_name]
|
||||
if 'admin' in c and c['admin'] and not all:
|
||||
continue
|
||||
synopsis = c['name']
|
||||
if 'parms' in c:
|
||||
synopsis = synopsis + " " + c['parms']
|
||||
SendTo(nick, "%s - %s" % (synopsis, c['help']))
|
||||
module = c['module']
|
||||
if module_name:
|
||||
if module_name != module:
|
||||
continue
|
||||
synopsis = c['name']
|
||||
if 'parms' in c:
|
||||
synopsis = synopsis + " " + c['parms']
|
||||
SendTo(nick, "%s - %s" % (synopsis, c['help']))
|
||||
else:
|
||||
if module in msgs:
|
||||
msgs[module] = msgs[module] +(", ")
|
||||
else:
|
||||
msgs[module] = module + " module: "
|
||||
msgs[module] = msgs[module] +(c['name'])
|
||||
|
||||
if not module_name:
|
||||
for msg in msgs:
|
||||
SendTo(nick, "%s" % msgs[msg])
|
||||
|
||||
def RegisterCommand(command):
|
||||
commands[command['name']] = command
|
||||
|
|
|
@ -247,6 +247,7 @@ def RainActive(nick,chan,cmd):
|
|||
|
||||
|
||||
RegisterCommand({
|
||||
'module': 'tipping',
|
||||
'name': 'tip',
|
||||
'parms': '<nick> <amount>',
|
||||
'function': Tip,
|
||||
|
@ -254,6 +255,7 @@ RegisterCommand({
|
|||
'help': "tip another user"
|
||||
})
|
||||
RegisterCommand({
|
||||
'module': 'tipping',
|
||||
'name': 'rain',
|
||||
'parms': '<amount> [<users>]',
|
||||
'function': Rain,
|
||||
|
@ -261,6 +263,7 @@ RegisterCommand({
|
|||
'help': "rain some coins on everyone (or just a few)"
|
||||
})
|
||||
RegisterCommand({
|
||||
'module': 'tipping',
|
||||
'name': 'rainactive',
|
||||
'parms': '<amount> [<hours>]',
|
||||
'function': RainActive,
|
||||
|
|
|
@ -147,6 +147,7 @@ def Withdraw(nick,chan,cmd):
|
|||
|
||||
|
||||
RegisterCommand({
|
||||
'module': 'withdraw',
|
||||
'name': 'withdraw',
|
||||
'parms': '<address> [<amount>]',
|
||||
'function': Withdraw,
|
||||
|
@ -154,12 +155,14 @@ RegisterCommand({
|
|||
'help': "withdraw part or all of your balance"
|
||||
})
|
||||
RegisterCommand({
|
||||
'module': 'withdraw',
|
||||
'name': 'enable_withdraw',
|
||||
'function': EnableWithdraw,
|
||||
'admin': True,
|
||||
'help': "Enable withdrawals"
|
||||
})
|
||||
RegisterCommand({
|
||||
'module': 'withdraw',
|
||||
'name': 'disable_withdraw',
|
||||
'function': DisableWithdraw,
|
||||
'admin': True,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue