mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
test
This commit is contained in:
parent
119a6d80d8
commit
6a3e6cf210
@ -69,7 +69,7 @@ def prerun_old(trigger_command_type='module'):
|
|||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
def prerun(message="this is not privmsg", reply=False):
|
def prerun(trigger_command_type="this is not privmsg"):
|
||||||
|
|
||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
@ -77,18 +77,15 @@ def prerun(message="this is not privmsg", reply=False):
|
|||||||
# Assign trigger and bot for easy access later
|
# Assign trigger and bot for easy access later
|
||||||
bot, trigger = args[0:2]
|
bot, trigger = args[0:2]
|
||||||
if not trigger.is_privmsg:
|
if not trigger.is_privmsg:
|
||||||
if message and not callable(message):
|
if trigger_command_type and not callable(trigger_command_type):
|
||||||
if reply:
|
bot.say(trigger_command_type)
|
||||||
bot.reply(message)
|
|
||||||
else:
|
|
||||||
bot.say(message)
|
|
||||||
else:
|
else:
|
||||||
return function(*args, **kwargs)
|
return function(*args, **kwargs)
|
||||||
return _nop
|
return _nop
|
||||||
|
|
||||||
# Hack to allow decorator without parens
|
# Hack to allow decorator without parens
|
||||||
if callable(message):
|
if callable(trigger_command_type):
|
||||||
return actual_decorator(message)
|
return actual_decorator(trigger_command_type)
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user