This commit is contained in:
deathbybandaid 2019-05-03 11:43:26 -04:00
parent e3f75d733c
commit ef250cf636
4 changed files with 46 additions and 4 deletions

View File

@ -0,0 +1,29 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
import sopel_modules.osd
import spicemanip
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, bot_privs
def configure(config):
pass
def setup(bot):
pass
@sopel.module.nickname_commands('admins', 'owners', 'owner')
def bot_command_hub(bot, trigger):
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
if triggercommand == 'owner':
triggercommand = 'owners'
privlist = spicemanip.main(bot_privs(bot, triggercommand), 'andlist')
bot.osd(str(bot.nick) + " " + triggercommand + ": " + privlist)

View File

@ -0,0 +1,8 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
from .BotPrivs import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.0'

View File

@ -38,7 +38,7 @@ def bot_command_hub(bot, trigger):
bot.osd("Channel/nick name {} not valid.".format(target))
return
triggerargs = spicemanip.main(triggerargs, '2+')
triggerargs = spicemanip.main(triggerargs, '2+', 'list')
if target == 'allchans':
targetsendlist = bot.channels.keys()

View File

@ -36,15 +36,20 @@ def sopel_triggerargs(bot, trigger, command_type='module_command'):
return triggerargs, command
def bot_privs(bot, privtype):
botpriveval = eval("bot.config.core." + privtype)
if not isinstance(botpriveval, list):
botpriveval = [botpriveval]
return botpriveval
def command_permissions_check(bot, trigger, privslist):
commandrunconsensus = []
for botpriv in ["admins", "owner"]:
if botpriv in privslist:
botpriveval = eval("bot.config.core." + botpriv)
if not isinstance(botpriveval, list):
botpriveval = [botpriv]
botpriveval = bot_privs(bot, botpriv)
if not inlist(bot, trigger.nick, botpriveval):
commandrunconsensus.append('False')
else: