mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 22:49:53 -05:00
events tweaking
This commit is contained in:
parent
fbe22143fc
commit
9dfbfd3634
@ -14,9 +14,6 @@ from sopel_modules.SpiceBot_Events.System import botevents
|
|||||||
@sopel.module.nickname_commands('(.*)')
|
@sopel.module.nickname_commands('(.*)')
|
||||||
def bot_command_nick(bot, trigger):
|
def bot_command_nick(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check([botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||||
|
|
||||||
if not triggercommand:
|
if not triggercommand:
|
||||||
|
|||||||
@ -18,9 +18,6 @@ from .Channels import bot_part_empty
|
|||||||
@sopel.module.nickname_commands('channels', 'channel')
|
@sopel.module.nickname_commands('channels', 'channel')
|
||||||
def nickname_comand_channels(bot, trigger):
|
def nickname_comand_channels(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_LOADED):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||||
|
|
||||||
if not len(triggerargs):
|
if not len(triggerargs):
|
||||||
|
|||||||
@ -16,9 +16,6 @@ import spicemanip
|
|||||||
@sopel.module.nickname_commands('(.*)')
|
@sopel.module.nickname_commands('(.*)')
|
||||||
def query_detection_nick(bot, trigger):
|
def query_detection_nick(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_COMMANDSQUERY):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||||
|
|
||||||
# command issued, check if valid
|
# command issued, check if valid
|
||||||
|
|||||||
@ -16,9 +16,6 @@ import spicemanip
|
|||||||
@sopel.module.rule('^\?(.*)')
|
@sopel.module.rule('^\?(.*)')
|
||||||
def query_detection(bot, trigger):
|
def query_detection(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_COMMANDSQUERY):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'query_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'query_command')
|
||||||
|
|
||||||
# command issued, check if valid
|
# command issued, check if valid
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import time
|
|||||||
@sopel.module.rule('.*')
|
@sopel.module.rule('.*')
|
||||||
def bot_startup_connection(bot, trigger):
|
def bot_startup_connection(bot, trigger):
|
||||||
botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")
|
botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")
|
||||||
|
|
||||||
while not len(bot.channels.keys()) > 0:
|
while not len(bot.channels.keys()) > 0:
|
||||||
pass
|
pass
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -27,11 +26,13 @@ def bot_startup_connection(bot, trigger):
|
|||||||
def bot_events_start(bot, trigger):
|
def bot_events_start(bot, trigger):
|
||||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||||
botevents.recieved(trigger)
|
botevents.recieved(trigger)
|
||||||
|
|
||||||
botevents.trigger(bot, botevents.BOT_READY, "Ready To Process module setup procedures")
|
botevents.trigger(bot, botevents.BOT_READY, "Ready To Process module setup procedures")
|
||||||
|
|
||||||
while not botevents.startup_check():
|
|
||||||
pass
|
@botevents.startup_check_ready()
|
||||||
|
@sopel.module.event(botevents.BOT_READY)
|
||||||
|
@sopel.module.rule('.*')
|
||||||
|
def bot_events_startup_complete(bot, trigger):
|
||||||
botevents.trigger(bot, botevents.BOT_LOADED, "All registered modules setup procedures have completed")
|
botevents.trigger(bot, botevents.BOT_LOADED, "All registered modules setup procedures have completed")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,14 +80,22 @@ class BotEvents(object):
|
|||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def _nop(*args, **kwargs):
|
def _nop(*args, **kwargs):
|
||||||
# Assign trigger and bot for easy access later
|
|
||||||
bot, trigger = args[0:2]
|
|
||||||
while not self.check(checklist):
|
while not self.check(checklist):
|
||||||
pass
|
pass
|
||||||
return function(*args, **kwargs)
|
return function(*args, **kwargs)
|
||||||
return _nop
|
return _nop
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
def startup_check_ready(self):
|
||||||
|
def actual_decorator(function):
|
||||||
|
@functools.wraps(function)
|
||||||
|
def _nop(*args, **kwargs):
|
||||||
|
while not self.startup_check():
|
||||||
|
pass
|
||||||
|
return function(*args, **kwargs)
|
||||||
|
return _nop
|
||||||
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
botevents = BotEvents()
|
botevents = BotEvents()
|
||||||
|
|
||||||
|
|||||||
@ -16,9 +16,6 @@ import spicemanip
|
|||||||
@module.commands('gif')
|
@module.commands('gif')
|
||||||
def gif_trigger(bot, trigger):
|
def gif_trigger(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_GIFSEARCH):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger)
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger)
|
||||||
if not len(triggerargs):
|
if not len(triggerargs):
|
||||||
return bot.osd("Please present a query to search.")
|
return bot.osd("Please present a query to search.")
|
||||||
|
|||||||
@ -16,9 +16,6 @@ from sopel_modules.SpiceBot_Events.System import botevents
|
|||||||
@sopel.module.commands('(.*)')
|
@sopel.module.commands('(.*)')
|
||||||
def gifapi_triggers(bot, trigger):
|
def gifapi_triggers(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_GIFSEARCH):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command')
|
||||||
|
|
||||||
if triggercommand not in bot.memory["SpiceBot_GifSearch"]['valid_gif_api_dict'].keys():
|
if triggercommand not in bot.memory["SpiceBot_GifSearch"]['valid_gif_api_dict'].keys():
|
||||||
|
|||||||
@ -32,9 +32,6 @@ def bot_events_complete(bot, trigger):
|
|||||||
def InvalidCommand_triggers(bot, trigger):
|
def InvalidCommand_triggers(bot, trigger):
|
||||||
return
|
return
|
||||||
|
|
||||||
# while not botevents.check([botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command')
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command')
|
||||||
|
|
||||||
# patch for people typing "...", maybe other stuff, but this verifies that there is still a command here
|
# patch for people typing "...", maybe other stuff, but this verifies that there is still a command here
|
||||||
|
|||||||
@ -15,9 +15,6 @@ from .Logs import systemd_logs_fetch, stdio_logs_fetch
|
|||||||
@sopel.module.nickname_commands('logs', 'debug')
|
@sopel.module.nickname_commands('logs', 'debug')
|
||||||
def bot_command_logs(bot, trigger):
|
def bot_command_logs(bot, trigger):
|
||||||
|
|
||||||
# while not botevents.check(botevents.BOT_LOGS):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']):
|
||||||
bot.say("I was unable to process this Bot Nick command due to privilege issues.")
|
bot.say("I was unable to process this Bot Nick command due to privilege issues.")
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user