From 9051cb084e91400cad261137daa79480e49ca33f Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 31 May 2019 15:05:57 -0400 Subject: [PATCH] test --- sopel_modules/SpiceBot/Channels.py | 5 ----- sopel_modules/SpiceBot/Events.py | 5 +---- sopel_modules/SpiceBot/setup.py | 8 ++++++++ sopel_modules/SpiceBot_Core_Processing/Events.py | 7 +++++++ sopel_modules/SpiceBot_Core_Processing/Modules.py | 2 -- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sopel_modules/SpiceBot/Channels.py b/sopel_modules/SpiceBot/Channels.py index 5cfe318..b664c2d 100644 --- a/sopel_modules/SpiceBot/Channels.py +++ b/sopel_modules/SpiceBot/Channels.py @@ -8,12 +8,8 @@ from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute import re import threading -import time - -import spicemanip from .Config import config as botconfig -from .Events import events from .Logs import logs @@ -31,7 +27,6 @@ class BotChannels(): # SpiceBot logs.log('SpiceBot_Channels', "Setting Up BotChannels class") botconfig.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) - events.startup_add([events.BOT_CHANNELS]) self.lock = threading.Lock() self.channel_lock = False diff --git a/sopel_modules/SpiceBot/Events.py b/sopel_modules/SpiceBot/Events.py index 23a28f0..a716277 100644 --- a/sopel_modules/SpiceBot/Events.py +++ b/sopel_modules/SpiceBot/Events.py @@ -85,10 +85,7 @@ class BotEvents(object): else: eventnumber = str(trigger.event) message = trigger.args[1] - if int(eventnumber) in self.defaultevents: - logs.log('SpiceBot_Events', str(eventnumber) + " " + str(message), True) - else: - logs.log('SpiceBot_Events', str(eventnumber) + " " + str(message)) + logs.log('SpiceBot_Events', str(eventnumber) + " " + str(message)) if eventnumber not in self.dict["triggers_recieved"]: self.dict["triggers_recieved"][eventnumber] = [] self.dict["triggers_recieved"][eventnumber].append(message) diff --git a/sopel_modules/SpiceBot/setup.py b/sopel_modules/SpiceBot/setup.py index acd7f95..6931b3a 100644 --- a/sopel_modules/SpiceBot/setup.py +++ b/sopel_modules/SpiceBot/setup.py @@ -9,6 +9,7 @@ import os from .Config import config as botconfig from .Logs import logs +from .Events import events from .Channels import SpiceBot_Channels_MainSection from .Update import SpiceBot_Update_MainSection @@ -40,8 +41,15 @@ def setup(bot): # bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.raw.log') logs.log('SpiceBot_Channels', "Setting Up Configuration") + events.startup_add([events.BOT_CHANNELS]) bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) + logs.log('SpiceBot_Commands', "Setting Up Configuration") + events.startup_add([events.BOT_COMMANDS]) + logs.log('SpiceBot_Update', "Initial Setup processing") bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False) botconfig.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False) + + logs.log('SpiceBot_StartupMonologue', "Initial Setup processing") + events.startup_add([events.BOT_STARTUPMONOLOGUE_CHANNELS, events.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, events.BOT_STARTUPMONOLOGUE_CONNECTED]) diff --git a/sopel_modules/SpiceBot_Core_Processing/Events.py b/sopel_modules/SpiceBot_Core_Processing/Events.py index 279fa11..c7aea0e 100644 --- a/sopel_modules/SpiceBot_Core_Processing/Events.py +++ b/sopel_modules/SpiceBot_Core_Processing/Events.py @@ -8,6 +8,13 @@ import sopel import sopel_modules.SpiceBot as SpiceBot +@sopel.module.event(SpiceBot.events.BOT_WELCOME, SpiceBot.events.BOT_READY, SpiceBot.events.BOT_CONNECTED, SpiceBot.events.BOT_LOADED) +@sopel.module.rule('.*') +def bot_events_complete(bot, trigger): + """This is here simply to log to stderr that this was recieved.""" + SpiceBot.logs.log('SpiceBot_Events', trigger.args[1], True) + + @sopel.module.event(SpiceBot.events.RPL_WELCOME) @sopel.module.rule('.*') def bot_events_connected(bot, trigger): diff --git a/sopel_modules/SpiceBot_Core_Processing/Modules.py b/sopel_modules/SpiceBot_Core_Processing/Modules.py index d8ccace..62121db 100644 --- a/sopel_modules/SpiceBot_Core_Processing/Modules.py +++ b/sopel_modules/SpiceBot_Core_Processing/Modules.py @@ -12,8 +12,6 @@ import sopel_modules.SpiceBot as SpiceBot @sopel.module.rule('.*') def bot_events_complete(bot, trigger): - SpiceBot.events.startup_add([SpiceBot.events.BOT_COMMANDS]) - for comtype in SpiceBot.commands.dict['commands'].keys(): if comtype not in ['module', 'nickname', 'rule']: SpiceBot.logs.log('SpiceBot_Commands', "Found " + str(len(SpiceBot.commands.dict['commands'][comtype].keys())) + " " + comtype + " commands.", True)