This commit is contained in:
deathbybandaid 2019-05-31 15:05:57 -04:00
parent 98b97c4e08
commit 9051cb084e
5 changed files with 16 additions and 11 deletions

View File

@ -8,12 +8,8 @@ from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute
import re import re
import threading import threading
import time
import spicemanip
from .Config import config as botconfig from .Config import config as botconfig
from .Events import events
from .Logs import logs from .Logs import logs
@ -31,7 +27,6 @@ class BotChannels():
# SpiceBot # SpiceBot
logs.log('SpiceBot_Channels', "Setting Up BotChannels class") logs.log('SpiceBot_Channels', "Setting Up BotChannels class")
botconfig.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) botconfig.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
events.startup_add([events.BOT_CHANNELS])
self.lock = threading.Lock() self.lock = threading.Lock()
self.channel_lock = False self.channel_lock = False

View File

@ -85,9 +85,6 @@ class BotEvents(object):
else: else:
eventnumber = str(trigger.event) eventnumber = str(trigger.event)
message = trigger.args[1] 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"]: if eventnumber not in self.dict["triggers_recieved"]:
self.dict["triggers_recieved"][eventnumber] = [] self.dict["triggers_recieved"][eventnumber] = []

View File

@ -9,6 +9,7 @@ import os
from .Config import config as botconfig from .Config import config as botconfig
from .Logs import logs from .Logs import logs
from .Events import events
from .Channels import SpiceBot_Channels_MainSection from .Channels import SpiceBot_Channels_MainSection
from .Update import SpiceBot_Update_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') # 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") logs.log('SpiceBot_Channels', "Setting Up Configuration")
events.startup_add([events.BOT_CHANNELS])
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) 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") logs.log('SpiceBot_Update', "Initial Setup processing")
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False) bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
botconfig.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])

View File

@ -8,6 +8,13 @@ import sopel
import sopel_modules.SpiceBot as SpiceBot 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.event(SpiceBot.events.RPL_WELCOME)
@sopel.module.rule('.*') @sopel.module.rule('.*')
def bot_events_connected(bot, trigger): def bot_events_connected(bot, trigger):

View File

@ -12,8 +12,6 @@ import sopel_modules.SpiceBot as SpiceBot
@sopel.module.rule('.*') @sopel.module.rule('.*')
def bot_events_complete(bot, trigger): def bot_events_complete(bot, trigger):
SpiceBot.events.startup_add([SpiceBot.events.BOT_COMMANDS])
for comtype in SpiceBot.commands.dict['commands'].keys(): for comtype in SpiceBot.commands.dict['commands'].keys():
if comtype not in ['module', 'nickname', 'rule']: if comtype not in ['module', 'nickname', 'rule']:
SpiceBot.logs.log('SpiceBot_Commands', "Found " + str(len(SpiceBot.commands.dict['commands'][comtype].keys())) + " " + comtype + " commands.", True) SpiceBot.logs.log('SpiceBot_Commands', "Found " + str(len(SpiceBot.commands.dict['commands'][comtype].keys())) + " " + comtype + " commands.", True)