mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 06:29:54 -05:00
botevents instance
This commit is contained in:
parent
2347f4c540
commit
2cf80a320f
@ -7,7 +7,8 @@ import sopel.module
|
|||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, googlesearch, bot_privs, inlist, inlist_match, similar_list
|
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
|
from sopel_modules.SpiceBot_Events.System import bot_events_check, BotEvents
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.nickname_commands('(.*)')
|
@sopel.module.nickname_commands('(.*)')
|
||||||
|
|||||||
@ -6,12 +6,13 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
|||||||
import sopel.module
|
import sopel.module
|
||||||
from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute
|
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
|
from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, BotEvents
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_SBTools import (
|
from sopel_modules.SpiceBot_SBTools import (
|
||||||
join_all_channels, chanadmin_all_channels, channel_list_current,
|
join_all_channels, chanadmin_all_channels, channel_list_current,
|
||||||
bot_logging
|
bot_logging
|
||||||
)
|
)
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
|
|||||||
@ -6,12 +6,13 @@ import sopel.module
|
|||||||
|
|
||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents
|
from sopel_modules.SpiceBot_Events.System import bot_events_check, BotEvents
|
||||||
from sopel_modules.SpiceBot_SBTools import (
|
from sopel_modules.SpiceBot_SBTools import (
|
||||||
sopel_triggerargs, inlist, channel_privs,
|
sopel_triggerargs, inlist, channel_privs,
|
||||||
join_all_channels, channel_list_current,
|
join_all_channels, channel_list_current,
|
||||||
)
|
)
|
||||||
from .Channels import bot_part_empty
|
from .Channels import bot_part_empty
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.nickname_commands('channels', 'channel')
|
@sopel.module.nickname_commands('channels', 'channel')
|
||||||
|
|||||||
@ -7,8 +7,9 @@ import sopel.module
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, 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
|
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,9 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
|||||||
import sopel.module
|
import sopel.module
|
||||||
from sopel.trigger import PreTrigger
|
from sopel.trigger import PreTrigger
|
||||||
|
|
||||||
from .System import bot_events_trigger, bot_events_recieved, bot_events_startup_check, bot_events_setup_check, 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
|
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,35 @@ from sopel_modules.SpiceBot_SBTools import bot_logging
|
|||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
|
|
||||||
|
class BotEvents(object):
|
||||||
|
"""An dynamic listing of all the notable Bot numeric events.
|
||||||
|
|
||||||
|
Events contained in this module will utilize the 1000-range
|
||||||
|
|
||||||
|
All Other events will be tagged with a randomly generated
|
||||||
|
4-digit number above 2000.
|
||||||
|
|
||||||
|
This allows you to do, for example, ``@module.event(botevents.BOT_WELCOME)``
|
||||||
|
rather than ``@module.event('1001')``
|
||||||
|
"""
|
||||||
|
usednumbers = ['0', '1001', '1002', '1003', '1004']
|
||||||
|
|
||||||
|
BOT_WELCOME = '1001'
|
||||||
|
BOT_READY = '1002'
|
||||||
|
BOT_CONNECTED = '1003'
|
||||||
|
BOT_LOADED = '1004'
|
||||||
|
|
||||||
|
def __getattr__(self, attr):
|
||||||
|
eventnumber = 0
|
||||||
|
while eventnumber not in self.usednumbers:
|
||||||
|
eventnumber = randint(2000, 9999)
|
||||||
|
setattr(self, str(attr).upper(), str(eventnumber))
|
||||||
|
self.usednumbers.append(str(eventnumber))
|
||||||
|
|
||||||
|
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot_logging(bot, 'SpiceBot_Events', "Starting setup procedure")
|
bot_logging(bot, 'SpiceBot_Events', "Starting setup procedure")
|
||||||
bot_events_setup_check(bot)
|
bot_events_setup_check(bot)
|
||||||
@ -89,29 +118,3 @@ def bot_events_startup_check(bot):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class botevents(object):
|
|
||||||
"""An dynamic listing of all the notable Bot numeric events.
|
|
||||||
|
|
||||||
Events contained in this module will utilize the 1000-range
|
|
||||||
|
|
||||||
All Other events will be tagged with a randomly generated
|
|
||||||
4-digit number above 2000.
|
|
||||||
|
|
||||||
This allows you to do, for example, ``@module.event(botevents.BOT_WELCOME)``
|
|
||||||
rather than ``@module.event('1001')``
|
|
||||||
"""
|
|
||||||
usednumbers = ['0', '1001', '1002', '1003', '1004']
|
|
||||||
|
|
||||||
BOT_WELCOME = '1001'
|
|
||||||
BOT_READY = '1002'
|
|
||||||
BOT_CONNECTED = '1003'
|
|
||||||
BOT_LOADED = '1004'
|
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
|
||||||
eventnumber = 0
|
|
||||||
while eventnumber not in self.usednumbers:
|
|
||||||
eventnumber = randint(2000, 9999)
|
|
||||||
setattr(self, str(attr).upper(), str(eventnumber))
|
|
||||||
self.usednumbers.append(str(eventnumber))
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
|||||||
import sopel.module
|
import sopel.module
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs
|
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs
|
||||||
from sopel_modules.SpiceBot_Events.System import bot_events_check, bot_events_recieved, botevents
|
from sopel_modules.SpiceBot_Events.System import bot_events_check, bot_events_recieved, BotEvents
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
@ -6,7 +6,8 @@ import sopel.module
|
|||||||
from sopel.config.types import StaticSection, ValidatedAttribute
|
from sopel.config.types import StaticSection, ValidatedAttribute
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
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
|
from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, BotEvents
|
||||||
|
botevents = BotEvents()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,9 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
|||||||
|
|
||||||
import sopel.module
|
import sopel.module
|
||||||
|
|
||||||
from sopel_modules.SpiceBot_Events.System import bot_events_recieved, bot_events_trigger, 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
|
from sopel_modules.SpiceBot_SBTools import humanized_time, bot_logging
|
||||||
|
botevents = BotEvents()
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user