From 2d08f3befddecd044ea346c343c9cb530bb4321e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 15 May 2019 15:41:44 -0400 Subject: [PATCH] bot --- sopel_modules/SpiceBot_Channels/Channels.py | 2 +- sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py | 2 +- sopel_modules/SpiceBot_Events/Events.py | 8 ++++---- sopel_modules/SpiceBot_Events/System.py | 8 ++++---- sopel_modules/SpiceBot_GifSearch/gifsearch.py | 2 +- sopel_modules/SpiceBot_Logs/Logs.py | 2 +- .../SpiceBot_StartupMonologue/StartupMonologue_Display.py | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sopel_modules/SpiceBot_Channels/Channels.py b/sopel_modules/SpiceBot_Channels/Channels.py index 69aaa06..8e53d6c 100644 --- a/sopel_modules/SpiceBot_Channels/Channels.py +++ b/sopel_modules/SpiceBot_Channels/Channels.py @@ -74,7 +74,7 @@ def trigger_channel_list_initial(bot, trigger): channel_list_current(bot) foundchannelcount = len(bot.memory['SpiceBot_Channels']['channels'].keys()) bot_logging(bot, 'SpiceBot_Channels', "Channel listing finished! " + str(foundchannelcount) + " channel(s) found.") - botevents.trigger(botevents.BOT_CHANNELS, "SpiceBot_Channels") + botevents.trigger(bot, botevents.BOT_CHANNELS, "SpiceBot_Channels") join_all_channels(bot) chanadmin_all_channels(bot) diff --git a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py index a9d115d..dac3030 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py +++ b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py @@ -162,7 +162,7 @@ def setup(bot): if command not in bot.memory['SpiceBot_CommandsQuery']['nickrules']: bot.memory['SpiceBot_CommandsQuery']['nickrules'].append(command) - botevents.trigger(botevents.BOT_COMMANDSQUERY, "SpiceBot_CommandsQuery") + botevents.trigger(bot, botevents.BOT_COMMANDSQUERY, "SpiceBot_CommandsQuery") def shutdown(bot): diff --git a/sopel_modules/SpiceBot_Events/Events.py b/sopel_modules/SpiceBot_Events/Events.py index ebd095e..5933e42 100644 --- a/sopel_modules/SpiceBot_Events/Events.py +++ b/sopel_modules/SpiceBot_Events/Events.py @@ -14,12 +14,12 @@ import time @sopel.module.event('001') @sopel.module.rule('.*') def bot_startup_connection(bot, trigger): - botevents.trigger(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: pass time.sleep(1) - botevents.trigger(botevents.BOT_CONNECTED, "Bot Connected to IRC") + botevents.trigger(bot, botevents.BOT_CONNECTED, "Bot Connected to IRC") @sopel.module.event(botevents.BOT_WELCOME) @@ -28,11 +28,11 @@ def bot_events_start(bot, trigger): bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True) botevents.recieved(trigger) - botevents.trigger(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.trigger(botevents.BOT_LOADED, "All registered modules setup procedures have completed") + botevents.trigger(bot, botevents.BOT_LOADED, "All registered modules setup procedures have completed") @sopel.module.event(botevents.BOT_READY) diff --git a/sopel_modules/SpiceBot_Events/System.py b/sopel_modules/SpiceBot_Events/System.py index b5b9aed..2569ea5 100644 --- a/sopel_modules/SpiceBot_Events/System.py +++ b/sopel_modules/SpiceBot_Events/System.py @@ -38,14 +38,14 @@ class BotEvents(object): setattr(self, name, str(eventnumber)) return str(eventnumber) - def trigger(self, number, message="SpiceBot_Events"): + def trigger(self, bot, number, message="SpiceBot_Events"): number = str(number) if number in [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED, self.BOT_LOADED]: pretrigger = PreTrigger( - sopel.bot.nick, - ":SpiceBot_Events " + number + " " + str(sopel.bot.nick) + " :" + message + bot.nick, + ":SpiceBot_Events " + number + " " + str(bot.nick) + " :" + message ) - sopel.bot.dispatch(pretrigger) + bot.dispatch(pretrigger) else: pretriggerdict = {"number": number, "message": message} self.SpiceBot_Events["trigger_queue"].append(pretriggerdict) diff --git a/sopel_modules/SpiceBot_GifSearch/gifsearch.py b/sopel_modules/SpiceBot_GifSearch/gifsearch.py index 4050664..0ef935e 100644 --- a/sopel_modules/SpiceBot_GifSearch/gifsearch.py +++ b/sopel_modules/SpiceBot_GifSearch/gifsearch.py @@ -79,7 +79,7 @@ def setup(bot): if validgifapi not in bot.memory["SpiceBot_GifSearch"]['cache'].keys(): bot.memory["SpiceBot_GifSearch"]['cache'][validgifapi] = dict() - botevents.trigger(botevents.BOT_GIFSEARCH, "SpiceBot_GifSearch") + botevents.trigger(bot, botevents.BOT_GIFSEARCH, "SpiceBot_GifSearch") def shutdown(bot): diff --git a/sopel_modules/SpiceBot_Logs/Logs.py b/sopel_modules/SpiceBot_Logs/Logs.py index ed38629..69cfc15 100644 --- a/sopel_modules/SpiceBot_Logs/Logs.py +++ b/sopel_modules/SpiceBot_Logs/Logs.py @@ -30,7 +30,7 @@ def setup(bot): bot_logs_setup_check(bot) - botevents.trigger(botevents.BOT_LOGS, "SpiceBot_Logs") + botevents.trigger(bot, botevents.BOT_LOGS, "SpiceBot_Logs") def bot_logs_setup_check(bot): diff --git a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py index d47dc76..43c687e 100644 --- a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py +++ b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py @@ -19,7 +19,7 @@ def bot_startup_monologue_start(bot, trigger): bot_logging(bot, 'SpiceBot_StartupMonologue', bot.nick + " is now starting. Please wait while I load my configuration") bot.osd(" is now starting. Please wait while I load my configuration.", bot.channels.keys(), 'ACTION') - botevents.trigger(botevents.BOT_STARTUPMONOLOGUE_CONNECTED, "SpiceBot_StartupMonologue") + botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE_CONNECTED, "SpiceBot_StartupMonologue") @sopel.module.event(botevents.BOT_COMMANDSQUERY) @@ -35,7 +35,7 @@ def bot_startup_monologue_commands(bot, trigger): bot.memory['SpiceBot_StartupMonologue'].append("There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.") bot_logging(bot, 'SpiceBot_StartupMonologue', "There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.") - botevents.trigger(botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, "SpiceBot_StartupMonologue") + botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, "SpiceBot_StartupMonologue") @sopel.module.event(botevents.BOT_CHANNELS) @@ -47,7 +47,7 @@ def bot_startup_monologue_channels(bot, trigger): servercount = len(bot.memory['SpiceBot_Channels']['channels'].keys()) bot.memory['SpiceBot_StartupMonologue'].append("I am in " + str(botcount) + " of " + str(servercount) + " channel(s) available on this server.") - botevents.trigger(botevents.BOT_STARTUPMONOLOGUE_CHANNELS, "SpiceBot_StartupMonologue") + botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE_CHANNELS, "SpiceBot_StartupMonologue") @sopel.module.event(botevents.BOT_LOADED) @@ -64,5 +64,5 @@ def bot_startup_monologue_display(bot, trigger): bot.osd(bot.memory['SpiceBot_StartupMonologue'], bot.channels.keys(), 'ACTION') - botevents.trigger(botevents.BOT_STARTUPMONOLOGUE, "SpiceBot_StartupMonologue") + botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE, "SpiceBot_StartupMonologue") bot_logging(bot, 'SpiceBot_StartupMonologue', "Startup Monologue has been issued to all channels.", True)