diff --git a/sopel_modules/SpiceBot_AI/AI.py b/sopel_modules/SpiceBot_AI/AI.py index 70b1e9a..8fd489a 100644 --- a/sopel_modules/SpiceBot_AI/AI.py +++ b/sopel_modules/SpiceBot_AI/AI.py @@ -7,8 +7,7 @@ import sopel.module import spicemanip from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, googlesearch, bot_privs, inlist, inlist_match, similar_list -from sopel_modules.SpiceBot_Events.System import bot_events_check, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents @sopel.module.nickname_commands('(.*)') diff --git a/sopel_modules/SpiceBot_Channels/Channels.py b/sopel_modules/SpiceBot_Channels/Channels.py index efe0332..2ca8c89 100644 --- a/sopel_modules/SpiceBot_Channels/Channels.py +++ b/sopel_modules/SpiceBot_Channels/Channels.py @@ -6,8 +6,7 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi import sopel.module from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute -from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, botevents from sopel_modules.SpiceBot_SBTools import ( join_all_channels, chanadmin_all_channels, channel_list_current, bot_logging @@ -35,7 +34,7 @@ def configure(config): def setup(bot): bot_logging(bot, 'SpiceBot_Channels', "Starting setup procedure") - bot_events_startup_register(bot, [botevents.BOT_CHANNELS]) + bot_events_startup_register(bot, ['2001']) bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) @@ -75,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.") - bot_events_trigger(bot, botevents.BOT_CHANNELS, "SpiceBot_Channels") + bot_events_trigger(bot, '2001', "SpiceBot_Channels") join_all_channels(bot) chanadmin_all_channels(bot) @@ -124,7 +123,7 @@ def bot_part_empty(bot): del bot.memory['SpiceBot_Channels']['channels'][channel.lower()] -@sopel.module.event(botevents.BOT_CHANNELS) +@sopel.module.event('2001') @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_Channels/Channels_Command.py b/sopel_modules/SpiceBot_Channels/Channels_Command.py index 906f5ea..c7e69bc 100644 --- a/sopel_modules/SpiceBot_Channels/Channels_Command.py +++ b/sopel_modules/SpiceBot_Channels/Channels_Command.py @@ -6,8 +6,7 @@ import sopel.module import spicemanip -from sopel_modules.SpiceBot_Events.System import bot_events_check, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents from sopel_modules.SpiceBot_SBTools import ( sopel_triggerargs, inlist, channel_privs, join_all_channels, channel_list_current, diff --git a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py index 9079215..2d9e2ce 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py +++ b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py @@ -7,8 +7,7 @@ import sopel.module import os -from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, botevents from sopel_modules.SpiceBot_SBTools import bot_logging import spicemanip diff --git a/sopel_modules/SpiceBot_Events/Events.py b/sopel_modules/SpiceBot_Events/Events.py index 736f595..730cb4f 100644 --- a/sopel_modules/SpiceBot_Events/Events.py +++ b/sopel_modules/SpiceBot_Events/Events.py @@ -5,8 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module from sopel.trigger import PreTrigger -from .System import bot_events_trigger, bot_events_recieved, bot_events_startup_check, bot_events_setup_check, BotEvents -botevents = BotEvents() +from .System import bot_events_trigger, bot_events_recieved, bot_events_startup_check, bot_events_setup_check, botevents from sopel_modules.SpiceBot_SBTools import bot_logging import time diff --git a/sopel_modules/SpiceBot_Events/System.py b/sopel_modules/SpiceBot_Events/System.py index 6058a5c..d6bdfd4 100644 --- a/sopel_modules/SpiceBot_Events/System.py +++ b/sopel_modules/SpiceBot_Events/System.py @@ -11,7 +11,7 @@ from sopel_modules.SpiceBot_SBTools import bot_logging from random import randint -class BotEvents(object): +class botevents(object): """An dynamic listing of all the notable Bot numeric events. Events contained in this module will utilize the 1000-range @@ -23,13 +23,12 @@ class BotEvents(object): rather than ``@module.event('1001')`` """ - def __init__(self): - self.usednumbers = ['0', '1001', '1002', '1003', '1004'] + usednumbers = ['0', '1001', '1002', '1003', '1004'] - self.BOT_WELCOME = '1001' - self.BOT_READY = '1002' - self.BOT_CONNECTED = '1003' - self.BOT_LOADED = '1004' + BOT_WELCOME = '1001' + BOT_READY = '1002' + BOT_CONNECTED = '1003' + BOT_LOADED = '1004' def __getattr__(self, attr): eventnumber = 0 @@ -40,9 +39,6 @@ class BotEvents(object): return eventnumber -botevents = BotEvents() - - def setup(bot): bot_logging(bot, 'SpiceBot_Events', "Starting setup procedure") bot_events_setup_check(bot) diff --git a/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py b/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py index 71dc9ae..41c5f69 100644 --- a/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py +++ b/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py @@ -5,8 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module from sopel_modules.SpiceBot_SBTools import sopel_triggerargs -from sopel_modules.SpiceBot_Events.System import bot_events_check, bot_events_recieved, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_check, bot_events_recieved, botevents def setup(bot): diff --git a/sopel_modules/SpiceBot_Logs/Logs.py b/sopel_modules/SpiceBot_Logs/Logs.py index dc4584b..4be59f0 100644 --- a/sopel_modules/SpiceBot_Logs/Logs.py +++ b/sopel_modules/SpiceBot_Logs/Logs.py @@ -6,8 +6,7 @@ import sopel.module from sopel.config.types import StaticSection, ValidatedAttribute from sopel_modules.SpiceBot_SBTools import bot_logging -from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, botevents import os diff --git a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py index 5ff6a7b..e638bfb 100644 --- a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py +++ b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py @@ -4,8 +4,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module -from sopel_modules.SpiceBot_Events.System import bot_events_recieved, bot_events_trigger, BotEvents -botevents = BotEvents() +from sopel_modules.SpiceBot_Events.System import bot_events_recieved, bot_events_trigger, botevents from sopel_modules.SpiceBot_SBTools import humanized_time, bot_logging import time @@ -39,7 +38,7 @@ def bot_startup_monologue_commands(bot, trigger): bot_events_trigger(bot, 2011, "SpiceBot_StartupMonologue") -@sopel.module.event(botevents.BOT_CHANNELS) +@sopel.module.event('2001') @sopel.module.rule('.*') def bot_startup_monologue_channels(bot, trigger): bot_events_recieved(bot, trigger.event)