mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 14:39:54 -05:00
test not as class
This commit is contained in:
parent
1e4d1ce4e1
commit
56b6eec19b
@ -16,91 +16,77 @@ from .Commands import commands as botcommands
|
|||||||
from .Database import db as botdb
|
from .Database import db as botdb
|
||||||
|
|
||||||
|
|
||||||
class BotPrerun():
|
def prerun(trigger_command_type='module'):
|
||||||
def __init__(self):
|
def actual_decorator(function):
|
||||||
self.dict = {}
|
|
||||||
|
|
||||||
"""Command Splitting"""
|
@functools.wraps(function)
|
||||||
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
def prerun(self, trigger_command_type='module'):
|
# Primary command used for trigger, and a list of all words
|
||||||
def actual_decorator(function):
|
trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||||
|
|
||||||
@functools.wraps(function)
|
# Argsdict Defaults
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
argsdict_default = {}
|
||||||
|
argsdict_default["type"] = trigger_command_type
|
||||||
|
argsdict_default["com"] = trigger_command
|
||||||
|
|
||||||
# Primary command used for trigger, and a list of all words
|
realcom = botcommands.get_realcom(argsdict_default["com"], trigger_command_type)
|
||||||
trigger_args, trigger_command = self.trigger_args(trigger.args[1], trigger_command_type)
|
argsdict_default["realcom"] = realcom
|
||||||
|
|
||||||
# Argsdict Defaults
|
# split into && groupings
|
||||||
argsdict_default = {}
|
# and_split = trigger_and_split(trigger_args)
|
||||||
argsdict_default["type"] = trigger_command_type
|
|
||||||
argsdict_default["com"] = trigger_command
|
|
||||||
|
|
||||||
realcom = botcommands.get_realcom(argsdict_default["com"], trigger_command_type)
|
# Create dict listings for trigger.sb
|
||||||
argsdict_default["realcom"] = realcom
|
# argsdict_list = trigger_argsdict_list(argsdict_default, and_split)
|
||||||
|
argsdict = trigger_argsdict_single(argsdict_default, trigger_args)
|
||||||
|
|
||||||
# split into && groupings
|
trigger.sb = copy.deepcopy(argsdict)
|
||||||
# and_split = self.trigger_and_split(trigger_args)
|
|
||||||
|
|
||||||
# Create dict listings for trigger.sb
|
trigger.sb["args"], trigger.sb["hyphen_arg"] = trigger_hyphen_args(trigger.sb["args"])
|
||||||
# argsdict_list = self.trigger_argsdict_list(argsdict_default, and_split)
|
if not trigger.sb["hyphen_arg"]:
|
||||||
argsdict = self.trigger_argsdict_single(argsdict_default, trigger_args)
|
# check if anything prohibits the nick from running the command
|
||||||
|
if trigger_runstatus(bot, trigger):
|
||||||
|
return function(bot, trigger, *args, **kwargs)
|
||||||
|
else:
|
||||||
|
return trigger_hyphen_arg_handler(bot, trigger)
|
||||||
|
|
||||||
|
"""# Run the function for all splits
|
||||||
|
for argsdict in argsdict_list:
|
||||||
trigger.sb = copy.deepcopy(argsdict)
|
trigger.sb = copy.deepcopy(argsdict)
|
||||||
|
|
||||||
trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"])
|
trigger.sb["args"], trigger.sb["hyphen_arg"] = trigger_hyphen_args(trigger.sb["args"])
|
||||||
if not trigger.sb["hyphen_arg"]:
|
if not trigger.sb["hyphen_arg"]:
|
||||||
# check if anything prohibits the nick from running the command
|
# check if anything prohibits the nick from running the command
|
||||||
if self.trigger_runstatus(bot, trigger):
|
if trigger_runstatus(bot, trigger):
|
||||||
return function(bot, trigger, *args, **kwargs)
|
function(bot, trigger, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return self.trigger_hyphen_arg_handler(bot, trigger)
|
trigger_hyphen_arg_handler(bot, trigger)
|
||||||
|
"""
|
||||||
|
return internal_prerun
|
||||||
|
return actual_decorator
|
||||||
|
|
||||||
"""# Run the function for all splits
|
|
||||||
for argsdict in argsdict_list:
|
|
||||||
trigger.sb = copy.deepcopy(argsdict)
|
|
||||||
|
|
||||||
trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"])
|
def make_trigger_args(triggerargs_one, trigger_command_type='module'):
|
||||||
if not trigger.sb["hyphen_arg"]:
|
trigger_args = spicemanip.main(triggerargs_one, 'create')
|
||||||
# check if anything prohibits the nick from running the command
|
if trigger_command_type in ['nickname']:
|
||||||
if self.trigger_runstatus(bot, trigger):
|
trigger_command = spicemanip.main(trigger_args, 2).lower()
|
||||||
function(bot, trigger, *args, **kwargs)
|
trigger_args = spicemanip.main(trigger_args, '3+', 'list')
|
||||||
else:
|
else:
|
||||||
self.trigger_hyphen_arg_handler(bot, trigger)
|
trigger_command = spicemanip.main(trigger_args, 1).lower()[1:]
|
||||||
"""
|
trigger_args = spicemanip.main(trigger_args, '2+', 'list')
|
||||||
return internal_prerun
|
return trigger_args, trigger_command
|
||||||
return actual_decorator
|
|
||||||
|
|
||||||
def trigger_args(self, triggerargs_one, trigger_command_type='module'):
|
|
||||||
trigger_args = spicemanip.main(triggerargs_one, 'create')
|
|
||||||
if trigger_command_type in ['nickname']:
|
|
||||||
trigger_command = spicemanip.main(trigger_args, 2).lower()
|
|
||||||
trigger_args = spicemanip.main(trigger_args, '3+', 'list')
|
|
||||||
else:
|
|
||||||
trigger_command = spicemanip.main(trigger_args, 1).lower()[1:]
|
|
||||||
trigger_args = spicemanip.main(trigger_args, '2+', 'list')
|
|
||||||
return trigger_args, trigger_command
|
|
||||||
|
|
||||||
def trigger_and_split(self, trigger_args):
|
def trigger_and_split(trigger_args):
|
||||||
trigger_args_list_split = spicemanip.main(trigger_args, "split_&&")
|
trigger_args_list_split = spicemanip.main(trigger_args, "split_&&")
|
||||||
if not len(trigger_args_list_split):
|
if not len(trigger_args_list_split):
|
||||||
trigger_args_list_split.append([])
|
trigger_args_list_split.append([])
|
||||||
return trigger_args_list_split
|
return trigger_args_list_split
|
||||||
|
|
||||||
def trigger_argsdict_list(self, argsdict_default, and_split):
|
|
||||||
prerun_split = []
|
|
||||||
for trigger_args_part in and_split:
|
|
||||||
argsdict_part = copy.deepcopy(argsdict_default)
|
|
||||||
argsdict_part["args"] = spicemanip.main(trigger_args_part, 'create')
|
|
||||||
if len(argsdict_part["args"]) and argsdict_part["args"][0] == "-a":
|
|
||||||
argsdict_part["adminswitch"] = True
|
|
||||||
argsdict_part["args"] = spicemanip.main(argsdict_part["args"], '2+', 'list')
|
|
||||||
else:
|
|
||||||
argsdict_part["adminswitch"] = False
|
|
||||||
prerun_split.append(argsdict_part)
|
|
||||||
return prerun_split
|
|
||||||
|
|
||||||
def trigger_argsdict_single(self, argsdict_default, trigger_args_part):
|
def trigger_argsdict_list(argsdict_default, and_split):
|
||||||
|
prerun_split = []
|
||||||
|
for trigger_args_part in and_split:
|
||||||
argsdict_part = copy.deepcopy(argsdict_default)
|
argsdict_part = copy.deepcopy(argsdict_default)
|
||||||
argsdict_part["args"] = spicemanip.main(trigger_args_part, 'create')
|
argsdict_part["args"] = spicemanip.main(trigger_args_part, 'create')
|
||||||
if len(argsdict_part["args"]) and argsdict_part["args"][0] == "-a":
|
if len(argsdict_part["args"]) and argsdict_part["args"][0] == "-a":
|
||||||
@ -108,113 +94,126 @@ class BotPrerun():
|
|||||||
argsdict_part["args"] = spicemanip.main(argsdict_part["args"], '2+', 'list')
|
argsdict_part["args"] = spicemanip.main(argsdict_part["args"], '2+', 'list')
|
||||||
else:
|
else:
|
||||||
argsdict_part["adminswitch"] = False
|
argsdict_part["adminswitch"] = False
|
||||||
return argsdict_part
|
prerun_split.append(argsdict_part)
|
||||||
|
return prerun_split
|
||||||
|
|
||||||
def trigger_runstatus(self, bot, trigger):
|
|
||||||
|
|
||||||
# Bots can't run commands
|
def trigger_argsdict_single(argsdict_default, trigger_args_part):
|
||||||
if Identifier(trigger.nick) == bot.nick:
|
argsdict_part = copy.deepcopy(argsdict_default)
|
||||||
return False
|
argsdict_part["args"] = spicemanip.main(trigger_args_part, 'create')
|
||||||
|
if len(argsdict_part["args"]) and argsdict_part["args"][0] == "-a":
|
||||||
|
argsdict_part["adminswitch"] = True
|
||||||
|
argsdict_part["args"] = spicemanip.main(argsdict_part["args"], '2+', 'list')
|
||||||
|
else:
|
||||||
|
argsdict_part["adminswitch"] = False
|
||||||
|
return argsdict_part
|
||||||
|
|
||||||
# Allow permissions for enabling and disabling commands via hyphenargs
|
|
||||||
if trigger.sb["adminswitch"]:
|
|
||||||
if command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
bot.osd("The admin switch (-a) is for use by authorized nicks ONLY.", 'notice')
|
|
||||||
return False
|
|
||||||
|
|
||||||
if trigger.sb["hyphen_arg"]:
|
def trigger_runstatus(bot, trigger):
|
||||||
return False
|
|
||||||
|
|
||||||
# don't run commands that are disabled in channels
|
# Bots can't run commands
|
||||||
if not trigger.is_privmsg:
|
if Identifier(trigger.nick) == bot.nick:
|
||||||
commandused = trigger.sb["realcom"]
|
|
||||||
disabled_list = botdb.get_channel_value(trigger.sender, 'commands_disabled') or {}
|
|
||||||
if commandused in list(disabled_list.keys()):
|
|
||||||
reason = disabled_list[trigger.sb["realcom"]]["reason"]
|
|
||||||
timestamp = disabled_list[trigger.sb["realcom"]]["timestamp"]
|
|
||||||
bywhom = disabled_list[trigger.sb["realcom"]]["disabledby"]
|
|
||||||
message = "The " + str(trigger.sb["com"]) + " command was disabled by " + bywhom + " in " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason)
|
|
||||||
return self.trigger_cant_run(bot, trigger, message)
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def trigger_cant_run(self, bot, trigger, message=None):
|
|
||||||
if message:
|
|
||||||
bot.osd(message, trigger.nick, 'notice')
|
|
||||||
if command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
|
||||||
bot.osd("You however are authorized to bypass this warning with the (-a) admin switch.", trigger.nick, 'notice')
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def trigger_hyphen_args(self, trigger_args_part):
|
# Allow permissions for enabling and disabling commands via hyphenargs
|
||||||
valid_hyphen_args = [
|
if trigger.sb["adminswitch"]:
|
||||||
'check',
|
if command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
||||||
'enable', 'disable'
|
return True
|
||||||
]
|
|
||||||
hyphen_args = []
|
|
||||||
trigger_args_unhyphend = []
|
|
||||||
for worditem in trigger_args_part:
|
|
||||||
if str(worditem).startswith("--") and worditem[2:] in valid_hyphen_args:
|
|
||||||
hyphen_args.append(worditem[2:])
|
|
||||||
else:
|
|
||||||
trigger_args_unhyphend.append(worditem)
|
|
||||||
if len(hyphen_args):
|
|
||||||
hyphenarg = hyphen_args[0]
|
|
||||||
else:
|
else:
|
||||||
hyphenarg = None
|
bot.osd("The admin switch (-a) is for use by authorized nicks ONLY.", 'notice')
|
||||||
return trigger_args_unhyphend, hyphenarg
|
return False
|
||||||
|
|
||||||
def trigger_hyphen_arg_handler(self, bot, trigger):
|
if trigger.sb["hyphen_arg"]:
|
||||||
|
return False
|
||||||
|
|
||||||
# Commands that cannot run via privmsg
|
# don't run commands that are disabled in channels
|
||||||
if trigger.sb["hyphen_arg"] in ['check']:
|
if not trigger.is_privmsg:
|
||||||
if trigger.sb["com"].lower() != trigger.sb["realcom"]:
|
commandused = trigger.sb["realcom"]
|
||||||
bot.osd(trigger.sb["com"] + " is a valid alias command for " + trigger.sb["realcom"])
|
disabled_list = botdb.get_channel_value(trigger.sender, 'commands_disabled') or {}
|
||||||
else:
|
if commandused in list(disabled_list.keys()):
|
||||||
bot.osd(trigger.sb["com"] + " is a valid command")
|
reason = disabled_list[trigger.sb["realcom"]]["reason"]
|
||||||
return
|
timestamp = disabled_list[trigger.sb["realcom"]]["timestamp"]
|
||||||
|
bywhom = disabled_list[trigger.sb["realcom"]]["disabledby"]
|
||||||
|
message = "The " + str(trigger.sb["com"]) + " command was disabled by " + bywhom + " in " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason)
|
||||||
|
return trigger_cant_run(bot, trigger, message)
|
||||||
|
|
||||||
elif trigger.sb["hyphen_arg"] in ['enable']:
|
return True
|
||||||
|
|
||||||
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
|
||||||
bot.osd("I was unable to disable this command due to privilege issues.")
|
|
||||||
return
|
|
||||||
|
|
||||||
if trigger.is_privmsg:
|
def trigger_cant_run(bot, trigger, message=None):
|
||||||
bot.osd("This command must be run in a channel you which to enable it in.", trigger.nick, 'notice')
|
if message:
|
||||||
return
|
bot.osd(message, trigger.nick, 'notice')
|
||||||
|
if command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
||||||
|
bot.osd("You however are authorized to bypass this warning with the (-a) admin switch.", trigger.nick, 'notice')
|
||||||
|
return False
|
||||||
|
|
||||||
if not botcommands.check_commands_disabled(trigger.sb["realcom"], trigger.sender):
|
|
||||||
bot.osd(trigger.sb["com"] + " is already enabled in " + str(trigger.sender), trigger.nick, 'notice')
|
|
||||||
return
|
|
||||||
|
|
||||||
botcommands.unset_command_disabled(trigger.sb["realcom"], trigger.sender)
|
def trigger_hyphen_args(trigger_args_part):
|
||||||
bot.osd(trigger.sb["com"] + " is now enabled in " + str(trigger.sender))
|
valid_hyphen_args = [
|
||||||
return
|
'check',
|
||||||
|
'enable', 'disable'
|
||||||
|
]
|
||||||
|
hyphen_args = []
|
||||||
|
trigger_args_unhyphend = []
|
||||||
|
for worditem in trigger_args_part:
|
||||||
|
if str(worditem).startswith("--") and worditem[2:] in valid_hyphen_args:
|
||||||
|
hyphen_args.append(worditem[2:])
|
||||||
|
else:
|
||||||
|
trigger_args_unhyphend.append(worditem)
|
||||||
|
if len(hyphen_args):
|
||||||
|
hyphenarg = hyphen_args[0]
|
||||||
|
else:
|
||||||
|
hyphenarg = None
|
||||||
|
return trigger_args_unhyphend, hyphenarg
|
||||||
|
|
||||||
elif trigger.sb["hyphen_arg"] in ['disable']:
|
|
||||||
|
|
||||||
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
def trigger_hyphen_arg_handler(bot, trigger):
|
||||||
bot.osd("I was unable to disable this command due to privilege issues.")
|
|
||||||
return
|
|
||||||
|
|
||||||
if trigger.is_privmsg:
|
|
||||||
bot.osd("This command must be run in a channel you which to disable it in.", trigger.nick, 'notice')
|
|
||||||
return
|
|
||||||
|
|
||||||
if botcommands.check_commands_disabled(trigger.sb["realcom"], trigger.sender):
|
|
||||||
bot.osd(trigger.sb["com"] + " is already disabled in " + str(trigger.sender), trigger.nick, 'notice')
|
|
||||||
return
|
|
||||||
|
|
||||||
trailingmessage = spicemanip.main(trigger.sb["args"], 0) or "No reason given."
|
|
||||||
timestamp = str(datetime.datetime.utcnow())
|
|
||||||
|
|
||||||
botcommands.set_command_disabled(trigger.sb["realcom"], trigger.sender, timestamp, trailingmessage, trigger.nick)
|
|
||||||
bot.osd(trigger.sb["com"] + " is now disabled in " + str(trigger.sender))
|
|
||||||
return
|
|
||||||
|
|
||||||
|
# Commands that cannot run via privmsg
|
||||||
|
if trigger.sb["hyphen_arg"] in ['check']:
|
||||||
|
if trigger.sb["com"].lower() != trigger.sb["realcom"]:
|
||||||
|
bot.osd(trigger.sb["com"] + " is a valid alias command for " + trigger.sb["realcom"])
|
||||||
|
else:
|
||||||
|
bot.osd(trigger.sb["com"] + " is a valid command")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif trigger.sb["hyphen_arg"] in ['enable']:
|
||||||
|
|
||||||
prerun = BotPrerun()
|
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
||||||
|
bot.osd("I was unable to disable this command due to privilege issues.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if trigger.is_privmsg:
|
||||||
|
bot.osd("This command must be run in a channel you which to enable it in.", trigger.nick, 'notice')
|
||||||
|
return
|
||||||
|
|
||||||
|
if not botcommands.check_commands_disabled(trigger.sb["realcom"], trigger.sender):
|
||||||
|
bot.osd(trigger.sb["com"] + " is already enabled in " + str(trigger.sender), trigger.nick, 'notice')
|
||||||
|
return
|
||||||
|
|
||||||
|
botcommands.unset_command_disabled(trigger.sb["realcom"], trigger.sender)
|
||||||
|
bot.osd(trigger.sb["com"] + " is now enabled in " + str(trigger.sender))
|
||||||
|
return
|
||||||
|
|
||||||
|
elif trigger.sb["hyphen_arg"] in ['disable']:
|
||||||
|
|
||||||
|
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
||||||
|
bot.osd("I was unable to disable this command due to privilege issues.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if trigger.is_privmsg:
|
||||||
|
bot.osd("This command must be run in a channel you which to disable it in.", trigger.nick, 'notice')
|
||||||
|
return
|
||||||
|
|
||||||
|
if botcommands.check_commands_disabled(trigger.sb["realcom"], trigger.sender):
|
||||||
|
bot.osd(trigger.sb["com"] + " is already disabled in " + str(trigger.sender), trigger.nick, 'notice')
|
||||||
|
return
|
||||||
|
|
||||||
|
trailingmessage = spicemanip.main(trigger.sb["args"], 0) or "No reason given."
|
||||||
|
timestamp = str(datetime.datetime.utcnow())
|
||||||
|
|
||||||
|
botcommands.set_command_disabled(trigger.sb["realcom"], trigger.sender, timestamp, trailingmessage, trigger.nick)
|
||||||
|
bot.osd(trigger.sb["com"] + " is now disabled in " + str(trigger.sender))
|
||||||
|
return
|
||||||
|
|
||||||
|
return
|
||||||
|
|||||||
@ -9,13 +9,13 @@ import spicemanip
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('owners', 'owner')
|
@sopel.module.nickname_commands('owners', 'owner')
|
||||||
def bot_command_owners(bot, trigger):
|
def bot_command_owners(bot, trigger):
|
||||||
bot_command_process(bot, trigger)
|
bot_command_process(bot, trigger)
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('admins', 'admin')
|
@sopel.module.nickname_commands('admins', 'admin')
|
||||||
def bot_command_admins(bot, trigger):
|
def bot_command_admins(bot, trigger):
|
||||||
bot_command_process(bot, trigger)
|
bot_command_process(bot, trigger)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import sopel_modules.SpiceBot as SpiceBot
|
|||||||
|
|
||||||
|
|
||||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED])
|
@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED])
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('channels', 'channel')
|
@sopel.module.nickname_commands('channels', 'channel')
|
||||||
def nickname_comand_channels(bot, trigger):
|
def nickname_comand_channels(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,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.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('commands', 'command')
|
@sopel.module.nickname_commands('commands', 'command')
|
||||||
def nickname_comand_commands(bot, trigger):
|
def nickname_comand_commands(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -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.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('(.*)')
|
@sopel.module.nickname_commands('(.*)')
|
||||||
def query_detection_nick(bot, trigger):
|
def query_detection_nick(bot, trigger):
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ def query_detection_nick(bot, trigger):
|
|||||||
|
|
||||||
|
|
||||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
||||||
@SpiceBot.prerun.prerun('query')
|
@SpiceBot.prerun('query')
|
||||||
@sopel.module.rule('^\?(.*)')
|
@sopel.module.rule('^\?(.*)')
|
||||||
def query_detection(bot, trigger):
|
def query_detection(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import sopel.module
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('prefix')
|
@SpiceBot.prerun('prefix')
|
||||||
@sopel.module.commands('(.*)')
|
@sopel.module.commands('(.*)')
|
||||||
def command_dictcom(bot, trigger):
|
def command_dictcom(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import spicemanip
|
|||||||
# TODO custom gif shortcut commands
|
# TODO custom gif shortcut commands
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('gif_prefix')
|
@SpiceBot.prerun('gif_prefix')
|
||||||
@sopel.module.commands('gif')
|
@sopel.module.commands('gif')
|
||||||
def gif_trigger(bot, trigger):
|
def gif_trigger(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.prerun('gif_prefix')
|
@SpiceBot.prerun('gif_prefix')
|
||||||
@sopel.module.commands('(.*)')
|
@sopel.module.commands('(.*)')
|
||||||
def gifapi_triggers(bot, trigger):
|
def gifapi_triggers(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import sopel_modules.SpiceBot as SpiceBot
|
|||||||
|
|
||||||
|
|
||||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOGS])
|
@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOGS])
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('logs', 'debug')
|
@sopel.module.nickname_commands('logs', 'debug')
|
||||||
def bot_command_logs(bot, trigger):
|
def bot_command_logs(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -9,19 +9,19 @@ import spicemanip
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('action')
|
@sopel.module.nickname_commands('action')
|
||||||
def bot_command_action(bot, trigger):
|
def bot_command_action(bot, trigger):
|
||||||
bot_command_process(bot, trigger)
|
bot_command_process(bot, trigger)
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('notice')
|
@sopel.module.nickname_commands('notice')
|
||||||
def bot_command_notice(bot, trigger):
|
def bot_command_notice(bot, trigger):
|
||||||
bot_command_process(bot, trigger)
|
bot_command_process(bot, trigger)
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('privmsg', 'say', 'msg')
|
@sopel.module.nickname_commands('privmsg', 'say', 'msg')
|
||||||
def bot_command_privmsg(bot, trigger):
|
def bot_command_privmsg(bot, trigger):
|
||||||
bot_command_process(bot, trigger)
|
bot_command_process(bot, trigger)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import spicemanip
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun('nickname')
|
||||||
@sopel.module.nickname_commands('update')
|
@sopel.module.nickname_commands('update')
|
||||||
def nickname_comand_update(bot, trigger):
|
def nickname_comand_update(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import spicemanip
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('module')
|
@SpiceBot.prerun('module')
|
||||||
@sopel.module.commands('search', 'find', 'google', 'lookup')
|
@sopel.module.commands('search', 'find', 'google', 'lookup')
|
||||||
def search_main(bot, trigger):
|
def search_main(bot, trigger):
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ def search_main(bot, trigger):
|
|||||||
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])
|
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('module')
|
@SpiceBot.prerun('module')
|
||||||
@sopel.module.commands("where", "whereis")
|
@sopel.module.commands("where", "whereis")
|
||||||
def search_where(bot, trigger):
|
def search_where(bot, trigger):
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ def search_where(bot, trigger):
|
|||||||
bot.osd(["[Location search for " + str(searchterm) + "]", str(searchreturn)])
|
bot.osd(["[Location search for " + str(searchterm) + "]", str(searchreturn)])
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('module')
|
@SpiceBot.prerun('module')
|
||||||
@sopel.module.commands("what", "whatis")
|
@sopel.module.commands("what", "whatis")
|
||||||
def search_what(bot, trigger):
|
def search_what(bot, trigger):
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ def search_what(bot, trigger):
|
|||||||
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])
|
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('module')
|
@SpiceBot.prerun('module')
|
||||||
@sopel.module.commands("youtube", "video")
|
@sopel.module.commands("youtube", "video")
|
||||||
def search_video(bot, trigger):
|
def search_video(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import spicemanip
|
|||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('module')
|
@SpiceBot.prerun('module')
|
||||||
@sopel.module.commands('sherlock', 'username')
|
@sopel.module.commands('sherlock', 'username')
|
||||||
def bot_command_sherlock(bot, trigger):
|
def bot_command_sherlock(bot, trigger):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user