This commit is contained in:
deathbybandaid 2019-07-19 15:14:43 -04:00
parent 4e48b3f4e2
commit 079dc460fa
2 changed files with 16 additions and 3 deletions

View File

@ -295,5 +295,10 @@ class BotDictCommands():
def setup_dictcoms(self): def setup_dictcoms(self):
botconfig.define_section("SpiceBot_DictComs", SpiceBot_DictComs_MainSection, validate=False) botconfig.define_section("SpiceBot_DictComs", SpiceBot_DictComs_MainSection, validate=False)
def process(bot, trigger, botcom):
# use the default key, unless otherwise specified
botcom.dict["responsekey"] = "?default"
dictcoms = BotDictCommands() dictcoms = BotDictCommands()

View File

@ -102,7 +102,12 @@ def prerun(t_command_type='module', t_command_subtype=None):
botcom.dict["runcount"] = runcount botcom.dict["runcount"] = runcount
botcom.dict["args"], botcom.dict["hyphen_arg"] = trigger_hyphen_args(botcom.dict["args"]) botcom.dict["args"], botcom.dict["hyphen_arg"] = trigger_hyphen_args(botcom.dict["args"])
# special handling
botcom.dict["responsekey"] = "?default"
args_pass = trigger_hyphen_arg_handler(bot, trigger, botcom) args_pass = trigger_hyphen_arg_handler(bot, trigger, botcom)
if args_pass: if args_pass:
if trigger_runstatus(bot, trigger, botcom): if trigger_runstatus(bot, trigger, botcom):
function(bot, trigger, botcom, *args, **kwargs) function(bot, trigger, botcom, *args, **kwargs)
@ -267,7 +272,7 @@ def trigger_argsdict_single(argsdict_default, trigger_args_part):
def trigger_runstatus_query(bot, trigger, botcom): def trigger_runstatus_query(bot, trigger, botcom):
# Bots can't run commands # Bots can't run commands
if Identifier(trigger.nick) == bot.nick: if trigger.nick == bot.nick:
return False return False
# Allow permissions for enabling and disabling commands via hyphenargs # Allow permissions for enabling and disabling commands via hyphenargs
@ -334,7 +339,8 @@ def trigger_runstatus(bot, trigger, botcom):
if not trigger.is_privmsg: if not trigger.is_privmsg:
if str(trigger.sender).lower() in [x.lower() for x in botcom.dict["dict"]["hardcoded_channel_block"]]: if str(trigger.sender).lower() in [x.lower() for x in botcom.dict["dict"]["hardcoded_channel_block"]]:
botmessagelog.messagelog_error(botcom.dict["log_id"], "The " + str(botcom.dict["comtext"]) + " command cannot be used in " + str(trigger.sender) + " because it is hardcoded not to.") message = "The " + str(botcom.dict["comtext"]) + " command cannot be used in " + str(trigger.sender) + " because it is hardcoded not to."
return trigger_cant_run(bot, trigger, botcom, message)
if botcom.dict["runcount"] > 1: if botcom.dict["runcount"] > 1:
# check channel multirun blocks # check channel multirun blocks
@ -407,11 +413,13 @@ def trigger_hyphen_args(trigger_args_part):
'foldername', 'folderpath', 'foldername', 'folderpath',
"author", "author",
'contribs', 'contrib', "contributors", 'contribs', 'contrib', "contributors",
'alias', 'aliases' 'alias', 'aliases',
'random'
] ]
numdict = { numdict = {
"last": -1 "last": -1
} }
hyphen_args = [] hyphen_args = []
trigger_args_unhyphend = [] trigger_args_unhyphend = []
for worditem in trigger_args_part: for worditem in trigger_args_part: