mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -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('(.*)')
|
||||
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')
|
||||
|
||||
if not triggercommand:
|
||||
|
||||
@ -18,9 +18,6 @@ from .Channels import bot_part_empty
|
||||
@sopel.module.nickname_commands('channels', 'channel')
|
||||
def nickname_comand_channels(bot, trigger):
|
||||
|
||||
# while not botevents.check(botevents.BOT_LOADED):
|
||||
# pass
|
||||
|
||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||
|
||||
if not len(triggerargs):
|
||||
|
||||
@ -16,9 +16,6 @@ import spicemanip
|
||||
@sopel.module.nickname_commands('(.*)')
|
||||
def query_detection_nick(bot, trigger):
|
||||
|
||||
# while not botevents.check(botevents.BOT_COMMANDSQUERY):
|
||||
# pass
|
||||
|
||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||
|
||||
# command issued, check if valid
|
||||
|
||||
@ -16,9 +16,6 @@ import spicemanip
|
||||
@sopel.module.rule('^\?(.*)')
|
||||
def query_detection(bot, trigger):
|
||||
|
||||
# while not botevents.check(botevents.BOT_COMMANDSQUERY):
|
||||
# pass
|
||||
|
||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'query_command')
|
||||
|
||||
# command issued, check if valid
|
||||
|
||||
@ -15,7 +15,6 @@ import time
|
||||
@sopel.module.rule('.*')
|
||||
def bot_startup_connection(bot, trigger):
|
||||
botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")
|
||||
|
||||
while not len(bot.channels.keys()) > 0:
|
||||
pass
|
||||
time.sleep(1)
|
||||
@ -27,11 +26,13 @@ def bot_startup_connection(bot, trigger):
|
||||
def bot_events_start(bot, trigger):
|
||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||
botevents.recieved(trigger)
|
||||
|
||||
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")
|
||||
|
||||
|
||||
|
||||
@ -80,14 +80,22 @@ class BotEvents(object):
|
||||
def actual_decorator(function):
|
||||
@functools.wraps(function)
|
||||
def _nop(*args, **kwargs):
|
||||
# Assign trigger and bot for easy access later
|
||||
bot, trigger = args[0:2]
|
||||
while not self.check(checklist):
|
||||
pass
|
||||
return function(*args, **kwargs)
|
||||
return _nop
|
||||
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()
|
||||
|
||||
|
||||
@ -16,9 +16,6 @@ import spicemanip
|
||||
@module.commands('gif')
|
||||
def gif_trigger(bot, trigger):
|
||||
|
||||
# while not botevents.check(botevents.BOT_GIFSEARCH):
|
||||
# pass
|
||||
|
||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger)
|
||||
if not len(triggerargs):
|
||||
return bot.osd("Please present a query to search.")
|
||||
|
||||
@ -16,9 +16,6 @@ from sopel_modules.SpiceBot_Events.System import botevents
|
||||
@sopel.module.commands('(.*)')
|
||||
def gifapi_triggers(bot, trigger):
|
||||
|
||||
# while not botevents.check(botevents.BOT_GIFSEARCH):
|
||||
# pass
|
||||
|
||||
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command')
|
||||
|
||||
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):
|
||||
return
|
||||
|
||||
# while not botevents.check([botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]):
|
||||
# pass
|
||||
|
||||
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
|
||||
|
||||
@ -15,9 +15,6 @@ from .Logs import systemd_logs_fetch, stdio_logs_fetch
|
||||
@sopel.module.nickname_commands('logs', 'debug')
|
||||
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']):
|
||||
bot.say("I was unable to process this Bot Nick command due to privilege issues.")
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user