mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 22:49:53 -05:00
first _match test
This commit is contained in:
parent
9591b34cb1
commit
264187299d
@ -16,13 +16,18 @@ from .Commands import commands as botcommands
|
|||||||
from .Database import db as botdb
|
from .Database import db as botdb
|
||||||
|
|
||||||
|
|
||||||
def prerun(trigger_command_type='module'):
|
def prerun(t_command_type='module'):
|
||||||
|
|
||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
|
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
|
if t_command_type.endswith("_match"):
|
||||||
|
trigger_command_type = t_command_type.replace("_match", '')
|
||||||
|
else:
|
||||||
|
trigger_command_type = t_command_type
|
||||||
|
|
||||||
# Primary command used for trigger, and a list of all words
|
# Primary command used for trigger, and a list of all words
|
||||||
trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type)
|
trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||||
if trigger_command == 'uptime':
|
if trigger_command == 'uptime':
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import sopel_modules.SpiceBot as SpiceBot
|
|||||||
|
|
||||||
|
|
||||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
||||||
@SpiceBot.prerun('nickname')
|
@SpiceBot.prerun('nickname_match')
|
||||||
@sopel.module.nickname_commands('(.*)')
|
@sopel.module.nickname_commands('(.*)')
|
||||||
def query_detection_nick(bot, trigger):
|
def query_detection_nick(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import sopel.module
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun('prefix')
|
@SpiceBot.prerun('prefix_match')
|
||||||
@sopel.module.commands('(.*)')
|
@sopel.module.commands('(.*)')
|
||||||
def command_dictcom(bot, trigger):
|
def command_dictcom(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ def gif_trigger(bot, trigger):
|
|||||||
bot.osd(str(gifdict['gifapi'].title() + " Result (" + str(query) + " #" + str(gifdict["returnnum"]) + "): " + str(gifdict["returnurl"])))
|
bot.osd(str(gifdict['gifapi'].title() + " Result (" + str(query) + " #" + str(gifdict["returnnum"]) + "): " + str(gifdict["returnurl"])))
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun('gif_prefix')
|
@SpiceBot.prerun('gif_prefix_match')
|
||||||
@sopel.module.commands('(.*)')
|
@sopel.module.commands('(.*)')
|
||||||
def gifapi_triggers(bot, trigger):
|
def gifapi_triggers(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user