mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
test
This commit is contained in:
parent
f7f7d51cac
commit
355145d33d
@ -104,12 +104,13 @@ def prerun(t_command_type='module', t_command_subtype=None):
|
||||
|
||||
botcom.dict["args"], botcom.dict["hyphen_arg"] = trigger_hyphen_args(botcom.dict["args"])
|
||||
|
||||
# special handling
|
||||
botcom = special_handling(botcom)
|
||||
|
||||
args_pass = trigger_hyphen_arg_handler(bot, trigger, botcom)
|
||||
|
||||
if args_pass:
|
||||
|
||||
# special handling
|
||||
botcom = special_handling(botcom)
|
||||
|
||||
if trigger_runstatus(bot, trigger, botcom):
|
||||
function(bot, trigger, botcom, *args, **kwargs)
|
||||
botmessagelog.messagelog_exit(bot, argsdict_default["log_id"])
|
||||
@ -118,20 +119,6 @@ def prerun(t_command_type='module', t_command_subtype=None):
|
||||
return actual_decorator
|
||||
|
||||
|
||||
def special_handling(botcom):
|
||||
botcom.dict["responsekey"] = "?default"
|
||||
|
||||
# handling for special cases
|
||||
posscom = spicemanip(botcom.dict['args'], 1)
|
||||
if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
|
||||
for command in botcom.dict["dict"]["nonstockoptions"]:
|
||||
if command.lower() == posscom.lower():
|
||||
posscom = command
|
||||
botcom.dict["responsekey"] = posscom
|
||||
|
||||
return botcom
|
||||
|
||||
|
||||
def prerun_query(t_command_type='module', t_command_subtype=None):
|
||||
|
||||
def actual_decorator(function):
|
||||
@ -447,6 +434,25 @@ def trigger_cant_run(bot, trigger, botcom, message=None):
|
||||
return False
|
||||
|
||||
|
||||
def special_handling(botcom):
|
||||
botcom.dict["responsekey"] = "?default"
|
||||
|
||||
if str(botcom.dict["hyphen_arg"]).lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
|
||||
botcom.dict["responsekey"] = str(botcom.dict["hyphen_arg"]).lower()
|
||||
|
||||
else:
|
||||
|
||||
# handling for special cases
|
||||
posscom = spicemanip(botcom.dict['args'], 1)
|
||||
if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
|
||||
for command in botcom.dict["dict"]["nonstockoptions"]:
|
||||
if command.lower() == posscom.lower():
|
||||
posscom = command
|
||||
botcom.dict["responsekey"] = posscom
|
||||
|
||||
return botcom
|
||||
|
||||
|
||||
def trigger_hyphen_args(trigger_args_part):
|
||||
|
||||
hyphen_args = []
|
||||
@ -472,7 +478,7 @@ def trigger_hyphen_args(trigger_args_part):
|
||||
clipped_word = w2n.word_to_num(str(clipped_word))
|
||||
hyphen_args.append(int(clipped_word))
|
||||
|
||||
# word is not a valid arg or number
|
||||
# word is not a valid arg or number
|
||||
except ValueError:
|
||||
trigger_args_unhyphend.append(worditem)
|
||||
else:
|
||||
|
||||
@ -11,7 +11,6 @@ import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
from sopel_modules.spicemanip import spicemanip
|
||||
|
||||
from word2number import w2n
|
||||
from random import randint
|
||||
import time
|
||||
|
||||
@ -35,25 +34,17 @@ def bot_dictcom_process(bot, trigger, botcom):
|
||||
botcom.dict['args'] = spicemanip(botcom.dict['args'], '2+', 'list')
|
||||
|
||||
# This allows users to specify which reply by number by using an ! and a digit (first or last in string)
|
||||
validspecifides = ['last', 'random', 'add', 'del', 'remove']
|
||||
botcom.dict["specified"] = None
|
||||
argone = spicemanip(botcom.dict['args'], 1)
|
||||
if str(argone).startswith("--") and len(str(argone)) > 2:
|
||||
if str(argone[2:]).isdigit():
|
||||
botcom.dict["specified"] = int(argone[2:])
|
||||
elif SpiceBot.inlist(str(argone[2:]), validspecifides):
|
||||
botcom.dict["specified"] = str(argone[2:]).lower()
|
||||
elif SpiceBot.inlist(str(argone[2:]), botcom.dict["dict"]["nonstockoptions"]):
|
||||
botcom.dict["specified"] = str(argone[2:]).lower()
|
||||
botcom.dict["responsekey"] = botcom.dict["specified"]
|
||||
else:
|
||||
try:
|
||||
botcom.dict["specified"] = w2n.word_to_num(str(argone[1:]))
|
||||
botcom.dict["specified"] = int(botcom.dict["specified"])
|
||||
except ValueError:
|
||||
botcom.dict["specified"] = None
|
||||
if botcom.dict["specified"]:
|
||||
botcom.dict['args'] = spicemanip(botcom.dict['args'], '2+', 'list')
|
||||
if botcom.dict["hyphen_arg"]:
|
||||
botcom.dict["specified"] = botcom.dict["hyphen_arg"]
|
||||
else:
|
||||
validspecifides = ['last', 'random', 'add', 'del', 'remove']
|
||||
botcom.dict["specified"] = None
|
||||
argone = spicemanip(botcom.dict['args'], 1)
|
||||
if str(argone).startswith("--") and len(str(argone)) > 2:
|
||||
if SpiceBot.inlist(str(argone[2:]), validspecifides):
|
||||
botcom.dict["specified"] = str(argone[2:]).lower()
|
||||
if botcom.dict["specified"]:
|
||||
botcom.dict['args'] = spicemanip(botcom.dict['args'], '2+', 'list')
|
||||
|
||||
# commands that can be updated
|
||||
if botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"]:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user