mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
command command
This commit is contained in:
parent
86792dc7fd
commit
98b97c4e08
@ -12,6 +12,39 @@ import spicemanip
|
||||
import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
|
||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
||||
@SpiceBot.prerun.prerun('nickname')
|
||||
@sopel.module.nickname_commands('commands', 'command')
|
||||
def nickname_comand_channels(bot, trigger):
|
||||
|
||||
if not len(trigger.sb['args']):
|
||||
commandused = 'list'
|
||||
else:
|
||||
commandused = spicemanip.main(trigger.sb['args'], 1).lower()
|
||||
|
||||
commands_list = []
|
||||
for commandstype in SpiceBot.commands.dict['commands'].keys():
|
||||
if commandstype not in ['rule']:
|
||||
for com in SpiceBot.commands.dict['commands'][commandstype].keys():
|
||||
if com not in commands_list:
|
||||
if commandstype in ['nickname']:
|
||||
commands_list.append(bot.nick + " " + com)
|
||||
else:
|
||||
commands_list.append(com)
|
||||
|
||||
if commandused == 'list':
|
||||
bot.osd(spicemanip.main(commands_list, 'andlist'), trigger.nick, 'NOTICE')
|
||||
return
|
||||
|
||||
elif commandused == 'total':
|
||||
bot.osd("I have " + str(len(commands_list)) + " commands available.")
|
||||
return
|
||||
|
||||
elif commandused == 'random':
|
||||
bot.osd(["Here's a random command for you:", + spicemanip.main(commands_list, 'random')])
|
||||
return
|
||||
|
||||
|
||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
||||
@SpiceBot.prerun.prerun('nickname')
|
||||
@sopel.module.nickname_commands('(.*)')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user