Attempt SpiceBot import start

This commit is contained in:
deathbybandaid 2019-05-18 14:25:32 -04:00
parent 79e9b39961
commit 4f3909948f
30 changed files with 92 additions and 66 deletions

View File

@ -1,10 +1,14 @@
#!/usr/bin/env python # coding=utf8
# coding=utf-8 from __future__ import unicode_literals, absolute_import, division, print_function
from __future__ import unicode_literals, absolute_import, print_function, division """
This is the SpiceBot events system.
We utilize the Sopel code for event numbers and
self-trigger the bot into performing actions
"""
# sopel imports
import sopel import sopel
from sopel.trigger import PreTrigger
import functools import functools
@ -45,7 +49,7 @@ class BotEvents(object):
def trigger(self, bot, number, message="SpiceBot_Events"): def trigger(self, bot, number, message="SpiceBot_Events"):
number = str(number) number = str(number)
if number in self.defaultevents or self.check(self.BOT_CONNECTED): if number in self.defaultevents or self.check(self.BOT_CONNECTED):
pretrigger = PreTrigger( pretrigger = sopel.trigger.PreTrigger(
bot.nick, bot.nick,
":SpiceBot_Events " + number + " " + str(bot.nick) + " :" + message ":SpiceBot_Events " + number + " " + str(bot.nick) + " :" + message
) )

View File

@ -1,12 +1,14 @@
# coding=utf-8 # coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot Logs system.
import sopel.module This Class stores logs in an easy to access manner
import sopel.tools """
import sopel.config
import sopel
import os import os
import spicemanip import spicemanip
@ -102,23 +104,3 @@ class botlogs():
botlogs = botlogs() botlogs = botlogs()
@sopel.module.event('001')
@sopel.module.rule('.*')
def join_log_channel(bot, trigger):
if bot.config.core.logging_channel:
channel = bot.config.core.logging_channel
if channel not in bot.channels.keys():
bot.write(('JOIN', bot.nick, channel))
if channel not in bot.channels.keys() and bot.config.SpiceBot_Channels.operadmin:
bot.write(('SAJOIN', bot.nick, channel))
while True:
if len(botlogs.SpiceBot_Logs["queue"]):
bot.say(str(botlogs.SpiceBot_Logs["queue"][0]), channel)
del botlogs.SpiceBot_Logs["queue"][0]
else:
botlogs.sopel_config["logging_channel"] = False
botlogs.SpiceBot_Logs["queue"] = []

View File

@ -0,0 +1,14 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
These are the core SpiceBot Classes
This module contains references only for other modules to utilize.
"""
from .Logs import *
from .Events import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.1'

View File

@ -7,7 +7,7 @@ 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 botevents from sopel_modules.SpiceBot.Events import botevents
@botevents.check_ready([botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]) @botevents.check_ready([botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY])

View File

@ -6,8 +6,8 @@ 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_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_SBTools import join_all_channels, chanadmin_all_channels, channel_list_current from sopel_modules.SpiceBot_SBTools import join_all_channels, chanadmin_all_channels, channel_list_current
import spicemanip import spicemanip

View File

@ -6,7 +6,7 @@ import sopel.module
import spicemanip import spicemanip
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import 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,

View File

@ -7,8 +7,8 @@ import sopel.module
import os import os
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
import spicemanip import spicemanip

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel import sopel
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel import sopel
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string

View File

@ -10,7 +10,7 @@ from sopel.db import SopelDB, NickValues, ChannelValues
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
import json import json
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
def setup(bot): def setup(bot):

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
# sopel imports # sopel imports
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
def setup(bot): def setup(bot):

View File

@ -5,8 +5,8 @@ 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 sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from .System import botevents from sopel_modules.SpiceBot.Events import botevents
import time import time

View File

@ -1,7 +1,6 @@
# coding=utf8 # coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function from __future__ import unicode_literals, absolute_import, division, print_function
from .System import *
from .Events import * from .Events import *
__author__ = 'Sam Zick' __author__ = 'Sam Zick'

View File

@ -7,7 +7,7 @@ from sopel import module
from .gifsearch import getGif from .gifsearch import getGif
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs from sopel_modules.SpiceBot_SBTools import sopel_triggerargs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
import spicemanip import spicemanip

View File

@ -9,7 +9,7 @@ import sopel.module
import spicemanip import spicemanip
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs from sopel_modules.SpiceBot_SBTools import sopel_triggerargs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
@botevents.check_ready([botevents.BOT_GIFSEARCH]) @botevents.check_ready([botevents.BOT_GIFSEARCH])

View File

@ -5,8 +5,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel.module import sopel.module
from sopel.config.types import StaticSection, ValidatedAttribute from sopel.config.types import StaticSection, ValidatedAttribute
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register
from sopel_modules.SpiceBot_SBTools import read_directory_json_to_dict from sopel_modules.SpiceBot_SBTools import read_directory_json_to_dict

View File

@ -5,7 +5,7 @@ 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 botevents from sopel_modules.SpiceBot.Events import botevents
def setup(bot): def setup(bot):

View File

@ -14,7 +14,7 @@ from sopel import tools, module
from sopel.tools import Identifier from sopel.tools import Identifier
from sopel.config.types import StaticSection, ValidatedAttribute from sopel.config.types import StaticSection, ValidatedAttribute
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
import time import time

View File

@ -3,9 +3,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot.Events import botevents
from .Logs import botlogs
@sopel.module.event(botevents.BOT_STARTUPMONOLOGUE) @sopel.module.event(botevents.BOT_STARTUPMONOLOGUE)

View File

@ -5,8 +5,8 @@ import sopel.module
import spicemanip import spicemanip
from .Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, inlist, inlist_match, similar_list from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, inlist, inlist_match, similar_list

View File

@ -0,0 +1,28 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
import sopel.tools
import sopel.config
from sopel_modules.SpiceBot.Logs import botlogs
@sopel.module.event('001')
@sopel.module.rule('.*')
def join_log_channel(bot, trigger):
if bot.config.core.logging_channel:
channel = bot.config.core.logging_channel
if channel not in bot.channels.keys():
bot.write(('JOIN', bot.nick, channel))
if channel not in bot.channels.keys() and bot.config.SpiceBot_Channels.operadmin:
bot.write(('SAJOIN', bot.nick, channel))
while True:
if len(botlogs.SpiceBot_Logs["queue"]):
bot.say(str(botlogs.SpiceBot_Logs["queue"][0]), channel)
del botlogs.SpiceBot_Logs["queue"][0]
else:
botlogs.sopel_config["logging_channel"] = False
botlogs.SpiceBot_Logs["queue"] = []

View File

@ -1,7 +1,7 @@
# coding=utf8 # coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function from __future__ import unicode_literals, absolute_import, division, print_function
from .Logs import * from .Queue import *
from .Logs_Command import * from .Logs_Command import *
from .ErrorDisplay import * from .ErrorDisplay import *

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
# sopel imports # sopel imports
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_SBTools import spicebot_reload from sopel_modules.SpiceBot_SBTools import spicebot_reload

View File

@ -20,7 +20,7 @@ from pygit2 import clone_repository
import spicemanip import spicemanip
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
"""Variable References""" """Variable References"""

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
import sopel import sopel
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_SBTools import stock_modules_begone from sopel_modules.SpiceBot_SBTools import stock_modules_begone

View File

@ -4,8 +4,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
def setup(bot): def setup(bot):

View File

@ -4,8 +4,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import sopel.module import sopel.module
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_Events.System import botevents from sopel_modules.SpiceBot.Events import botevents
from sopel_modules.SpiceBot_SBTools import humanized_time from sopel_modules.SpiceBot_SBTools import humanized_time
import time import time

View File

@ -8,7 +8,7 @@ from sopel.config.types import StaticSection, ValidatedAttribute
import spicemanip import spicemanip
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, spicebot_reload, spicebot_update from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, spicebot_reload, spicebot_update

View File

@ -6,7 +6,7 @@ import sopel.module
import time import time
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot_SBTools import humanized_time from sopel_modules.SpiceBot_SBTools import humanized_time

View File

@ -14,7 +14,7 @@ from sopel import tools, module
from sopel.tools import Identifier from sopel.tools import Identifier
from sopel.config.types import StaticSection, ValidatedAttribute from sopel.config.types import StaticSection, ValidatedAttribute
from sopel_modules.SpiceBot_Logs.Logs import botlogs from sopel_modules.SpiceBot.Logs import botlogs
import time import time
from collections import abc from collections import abc