From 4642d784e4050f138e81a443793aa58abb119e27 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 31 May 2019 13:19:56 -0400 Subject: [PATCH] test --- .../SpiceBot_Core_Processing/Events.py | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/sopel_modules/SpiceBot_Core_Processing/Events.py b/sopel_modules/SpiceBot_Core_Processing/Events.py index 5b8214c..279fa11 100644 --- a/sopel_modules/SpiceBot_Core_Processing/Events.py +++ b/sopel_modules/SpiceBot_Core_Processing/Events.py @@ -8,9 +8,17 @@ import sopel import sopel_modules.SpiceBot as SpiceBot -@sopel.module.event(SpiceBot.events.BOT_WELCOME) +@sopel.module.event(SpiceBot.events.RPL_WELCOME) @sopel.module.rule('.*') def bot_events_connected(bot, trigger): + + # Handling for connection count + SpiceBot.events.dict["RPL_WELCOME_Count"] += 1 + if SpiceBot.events.dict["RPL_WELCOME_Count"] > 1: + SpiceBot.events.trigger(bot, SpiceBot.events.BOT_RECONNECTED, "Bot ReConnected to IRC") + else: + SpiceBot.events.trigger(bot, SpiceBot.events.BOT_WELCOME, "Welcome to the SpiceBot Events System") + """For items tossed in a queue, this will trigger them accordingly""" while True: if len(SpiceBot.events.dict["trigger_queue"]): @@ -19,26 +27,12 @@ def bot_events_connected(bot, trigger): del SpiceBot.events.dict["trigger_queue"][0] -@sopel.module.event(SpiceBot.events.RPL_WELCOME) -@sopel.module.rule('.*') -def bot_startup_welcome(bot, trigger): - """The Bot events system does not start until RPL_WELCOME 001 is recieved - from the server""" - if SpiceBot.events.check(SpiceBot.events.BOT_WELCOME): - return - SpiceBot.events.trigger(bot, SpiceBot.events.BOT_WELCOME, "Welcome to the SpiceBot Events System") - - @sopel.module.event(SpiceBot.events.BOT_WELCOME) @sopel.module.rule('.*') def bot_events_start(bot, trigger): """This stage is redundant, but shows the system is working.""" SpiceBot.events.trigger(bot, SpiceBot.events.BOT_READY, "Ready To Process module setup procedures") - -@sopel.module.event(SpiceBot.events.BOT_WELCOME) -@sopel.module.rule('.*') -def bot_events_Connected(bot, trigger): """Here, we wait until we are in at least one channel""" while not len(bot.channels.keys()) > 0: pass @@ -51,11 +45,3 @@ def bot_events_Connected(bot, trigger): def bot_events_startup_complete(bot, trigger): """All events registered as required for startup have completed""" SpiceBot.events.trigger(bot, SpiceBot.events.BOT_LOADED, "All registered modules setup procedures have completed") - - -@sopel.module.event(SpiceBot.events.RPL_WELCOME) -@sopel.module.rule('.*') -def bot_startup_reconnect(bot, trigger): - SpiceBot.events.dict["RPL_WELCOME_Count"] += 1 - if SpiceBot.events.dict["RPL_WELCOME_Count"] > 1: - SpiceBot.events.trigger(bot, SpiceBot.events.BOT_RECONNECTED, "Bot ReConnected to IRC")