atest
This commit is contained in:
parent
3e4e389386
commit
6be4065f2c
@ -11,6 +11,8 @@ def prerun(rulematch=False):
|
||||
@functools.wraps(function)
|
||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||
|
||||
print([x for x in dir(function) if not x.startswith("__")])
|
||||
|
||||
# Get list of trigger command(s) by && split
|
||||
commands = sb.commands.get_commands_split(trigger, "&&")
|
||||
|
||||
@ -19,11 +21,12 @@ def prerun(rulematch=False):
|
||||
# Since there was more than one command,
|
||||
# we are going to redispatch commands
|
||||
# This will give sopel the appearance of recieving individual commands
|
||||
sb.osd(str(commands), trigger.sender)
|
||||
if len(commands) > 1:
|
||||
for trigger_dict in commands:
|
||||
sb.osd("multi - dispatching %s %s" % (trigger_dict["trigger_command"], trigger_dict["trigger_str"]), trigger.sender)
|
||||
sb.osd(str(trigger_dict), trigger.sender)
|
||||
if rulematch:
|
||||
if not sb.commands.is_real_command(trigger_dict):
|
||||
sb.commands.dispatch(trigger_dict)
|
||||
else:
|
||||
sb.commands.dispatch(trigger_dict)
|
||||
return
|
||||
|
||||
@ -31,7 +34,6 @@ def prerun(rulematch=False):
|
||||
# so we will now redispatch to help get the correct function passed
|
||||
trigger_command = sb.commands.get_command_from_trigger(trigger)
|
||||
if trigger_command != commands[0]["trigger_command"]:
|
||||
sb.osd("command changes - dispatching %s %s" % (commands[0]["trigger_command"], commands[0]["trigger_str"]), trigger.sender)
|
||||
sb.commands.dispatch(commands[0])
|
||||
return
|
||||
|
||||
|
||||
@ -4,11 +4,11 @@ from sopel import plugin
|
||||
from sopel_SpiceBot_Core_Prerun import prerun
|
||||
|
||||
|
||||
# @prerun(rulematch=True)
|
||||
# @plugin.command('(.*)')
|
||||
# def rule_command(bot, trigger, comrun):
|
||||
# bot.say("%s" % trigger.raw)
|
||||
# bot.say("now")
|
||||
# bot.say(str(comrun.trigger_dict))
|
||||
# comrun.say = "nothing"
|
||||
# bot.say(str(trigger.match))
|
||||
@prerun(rulematch=True)
|
||||
@plugin.command('(.*)')
|
||||
def rule_command(bot, trigger, comrun):
|
||||
bot.say("%s" % trigger.raw)
|
||||
bot.say("now")
|
||||
bot.say(str(comrun.trigger_dict))
|
||||
comrun.say = "nothing"
|
||||
bot.say(str(trigger.match))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user