mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
append issue
This commit is contained in:
parent
1298c811fb
commit
8ab1b69ea4
@ -58,6 +58,7 @@ class BotPrerun():
|
|||||||
if len(argsdict["hyphen_args"]):
|
if len(argsdict["hyphen_args"]):
|
||||||
self.hyphen_arg_handler(bot, trigger, argsdict)
|
self.hyphen_arg_handler(bot, trigger, argsdict)
|
||||||
|
|
||||||
|
# check if anything prohibits the nick from running the command
|
||||||
if self.runstatus(bot, trigger, argsdict):
|
if self.runstatus(bot, trigger, argsdict):
|
||||||
function(bot, trigger, *args, **kwargs)
|
function(bot, trigger, *args, **kwargs)
|
||||||
return
|
return
|
||||||
@ -80,15 +81,15 @@ class BotPrerun():
|
|||||||
trigger_args_list_split.append([])
|
trigger_args_list_split.append([])
|
||||||
return trigger_args_list_split
|
return trigger_args_list_split
|
||||||
|
|
||||||
def argsdict_list(self, argsdict_default, prerun_and_split):
|
def argsdict_list(self, argsdict_default, and_split):
|
||||||
prerun_split = []
|
prerun_split = []
|
||||||
for trigger_args_list in prerun_and_split:
|
for trigger_args_list in and_split:
|
||||||
argsdict = copy.deepcopy(argsdict_default)
|
argsdict_part = copy.deepcopy(argsdict_default)
|
||||||
trigger_args_part = spicemanip.main(trigger_args_list, 'create')
|
trigger_args_part = spicemanip.main(trigger_args_list, 'create')
|
||||||
trigger_args_part, hyphen_args = self.hyphen_args(trigger_args_part)
|
trigger_args_part, hyphen_args = self.hyphen_args(trigger_args_part)
|
||||||
argsdict["hyphen_args"] = hyphen_args
|
argsdict_part["hyphen_args"] = hyphen_args
|
||||||
argsdict["args"] = trigger_args_part
|
argsdict_part["args"] = trigger_args_part
|
||||||
prerun_split.append(argsdict)
|
prerun_split.append(argsdict_part)
|
||||||
return prerun_split
|
return prerun_split
|
||||||
|
|
||||||
def hyphen_args(self, trigger_args_part):
|
def hyphen_args(self, trigger_args_part):
|
||||||
@ -98,8 +99,10 @@ class BotPrerun():
|
|||||||
hyphen_args = []
|
hyphen_args = []
|
||||||
trigger_args_unhyphend = []
|
trigger_args_unhyphend = []
|
||||||
for worditem in trigger_args_part:
|
for worditem in trigger_args_part:
|
||||||
if str(worditem).startswith("--") and worditem[2:] in valid_hyphen_args:
|
if str(worditem).startswith("--"):
|
||||||
hyphen_args.append(worditem[2:])
|
hyphencom = worditem[2:]
|
||||||
|
if hyphencom in valid_hyphen_args:
|
||||||
|
hyphen_args.append(hyphencom)
|
||||||
else:
|
else:
|
||||||
trigger_args_unhyphend.append(worditem)
|
trigger_args_unhyphend.append(worditem)
|
||||||
return trigger_args_unhyphend, hyphen_args
|
return trigger_args_unhyphend, hyphen_args
|
||||||
@ -168,9 +171,9 @@ class BotPrerun():
|
|||||||
if not trigger.is_privmsg:
|
if not trigger.is_privmsg:
|
||||||
disabled_list = spicedb.get_channel_value(bot, trigger.sender, 'disabled_commands', 'commands') or {}
|
disabled_list = spicedb.get_channel_value(bot, trigger.sender, 'disabled_commands', 'commands') or {}
|
||||||
if argsdict["realcom"] in disabled_list.keys():
|
if argsdict["realcom"] in disabled_list.keys():
|
||||||
reason = disabled_list["disabled_commands"][argsdict["realcom"]]["reason"]
|
reason = disabled_list[argsdict["realcom"]]["reason"]
|
||||||
timestamp = disabled_list["disabled_commands"][argsdict["realcom"]]["timestamp"]
|
timestamp = disabled_list[argsdict["realcom"]]["timestamp"]
|
||||||
bywhom = disabled_list["disabled_commands"][argsdict["realcom"]]["disabledby"]
|
bywhom = disabled_list[argsdict["realcom"]]["disabledby"]
|
||||||
bot.notice("The " + str(argsdict["com"]) + " command was disabled by " + bywhom + " in " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason), trigger.nick)
|
bot.notice("The " + str(argsdict["com"]) + " command was disabled by " + bywhom + " in " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason), trigger.nick)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user