Update Command structure

This commit is contained in:
deathbybandaid 2019-05-03 11:48:52 -04:00
parent ef250cf636
commit 40babfc809
2 changed files with 30 additions and 4 deletions

View File

@ -18,8 +18,17 @@ def setup(bot):
pass
@sopel.module.nickname_commands('admins', 'owners', 'owner')
def bot_command_hub(bot, trigger):
@sopel.module.nickname_commands('owners', 'owner')
def bot_command_owners(bot, trigger):
bot_command_process(bot, trigger)
@sopel.module.nickname_commands('admins')
def bot_command_admins(bot, trigger):
bot_command_process(bot, trigger)
def bot_command_process(bot, trigger):
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
if triggercommand == 'owner':

View File

@ -18,8 +18,22 @@ def setup(bot):
pass
@sopel.module.nickname_commands('action', 'notice', 'privmsg')
def bot_command_hub(bot, trigger):
@sopel.module.nickname_commands('action')
def bot_command_action(bot, trigger):
bot_command_process(bot, trigger)
@sopel.module.nickname_commands('notice')
def bot_command_notice(bot, trigger):
bot_command_process(bot, trigger)
@sopel.module.nickname_commands('privmsg', 'say', 'msg')
def bot_command_privmsg(bot, trigger):
bot_command_process(bot, trigger)
def bot_command_process(bot, trigger):
if not command_permissions_check(bot, trigger, ['admins', 'owner']):
bot.say("I was unable to process this Bot Nick command due to privilege issues.")
@ -27,6 +41,9 @@ def bot_command_hub(bot, trigger):
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
if triggercommand in ['say', 'msg']:
triggercommand = 'privmsg'
if not len(triggerargs):
bot.say("You must specify a channel or nick.")
return