diff --git a/sopel_modules/SpiceBot/Database.py b/sopel_modules/SpiceBot/Database.py index 078d3b1..8d667f6 100644 --- a/sopel_modules/SpiceBot/Database.py +++ b/sopel_modules/SpiceBot/Database.py @@ -11,14 +11,12 @@ from sopel.db import SopelDB, _deserialize from .Config import config as botconfig -from sqlalchemy.engine.url import URL -from sqlalchemy import create_engine, Column, String, ForeignKey, Integer, Text +from sqlalchemy import Column, String, ForeignKey, Integer, Text from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.exc import SQLAlchemyError import json import threading -import os BASE = declarative_base() @@ -37,6 +35,7 @@ class Nicknames(BASE): Nicknames SQLAlchemy Class """ __tablename__ = 'spice_nicknames' + __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8mb4', 'mysql_collate': 'utf8mb4_unicode_ci'} nick_id = Column(Integer, ForeignKey('spice_nick_ids.nick_id'), primary_key=True) slug = Column(String(255), primary_key=True) canonical = Column(String(255)) @@ -47,6 +46,7 @@ class NickValues(BASE): NickValues SQLAlchemy Class """ __tablename__ = 'spice_nick_values' + __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8mb4', 'mysql_collate': 'utf8mb4_unicode_ci'} nick_id = Column(Integer, ForeignKey('spice_nick_ids.nick_id'), primary_key=True) namespace = Column(String(255), primary_key=True) key = Column(String(255), primary_key=True) @@ -58,6 +58,7 @@ class ChannelValues(BASE): ChannelValues SQLAlchemy Class """ __tablename__ = 'spice_channel_values' + __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8mb4', 'mysql_collate': 'utf8mb4_unicode_ci'} channel = Column(String(255), primary_key=True) namespace = Column(String(255), primary_key=True) key = Column(String(255), primary_key=True) @@ -69,6 +70,7 @@ class PluginValues(BASE): PluginValues SQLAlchemy Class """ __tablename__ = 'spice_plugin_values' + __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8mb4', 'mysql_collate': 'utf8mb4_unicode_ci'} plugin = Column(String(255), primary_key=True) namespace = Column(String(255), primary_key=True) key = Column(String(255), primary_key=True) @@ -533,48 +535,6 @@ class BotDatabase(): def __init__(self): - db_type = botconfig.core.db_type - - if db_type == 'sqlite': - path = botconfig.core.db_filename - config_dir, config_file = os.path.split(botconfig.filename) - config_name, _ = os.path.splitext(config_file) - if path is None: - path = os.path.join(config_dir, config_name + '.db') - path = os.path.expanduser(path) - if not os.path.isabs(path): - path = os.path.normpath(os.path.join(config_dir, path)) - SopelDB.filename = path - SopelDB.url = 'sqlite:///%s' % path - # Otherwise, handle all other database engines - else: - - if db_type == 'mysql': - drivername = botconfig.core.db_driver or 'mysql' - elif db_type == 'postgres': - drivername = botconfig.core.db_driver or 'postgresql' - elif db_type == 'oracle': - drivername = botconfig.core.db_driver or 'oracle' - elif db_type == 'mssql': - drivername = botconfig.core.db_driver or 'mssql+pymssql' - elif db_type == 'firebird': - drivername = botconfig.core.db_driver or 'firebird+fdb' - elif db_type == 'sybase': - drivername = botconfig.core.db_driver or 'sybase+pysybase' - else: - raise Exception('Unknown db_type') - - db_user = botconfig.core.db_user - db_pass = botconfig.core.db_pass - db_host = botconfig.core.db_host - db_port = botconfig.core.db_port # Optional - db_name = botconfig.core.db_name # Optional, depending on DB - - SopelDB.url = URL(drivername=drivername, username=db_user, password=db_pass, - host=db_host, port=db_port, database=db_name, query={'charset': 'utf8'}) - - SopelDB.engine = create_engine(SopelDB.url, encoding='utf-8') - SopelDB.nick_id_lock = threading.Lock() sopel.db.NickIDs = NickIDs diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 29f96a4..59d9d82 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -19,6 +19,7 @@ from .Channels import channels as botchannels from .MessageLog import messagelog as botmessagelog from .Config import config as botconfig from .Users import users as botusers +from .Events import events as botevents def prerun(t_command_type='module', t_command_subtype=None): @@ -28,6 +29,14 @@ def prerun(t_command_type='module', t_command_subtype=None): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): + # verify the bot is at a loaded state + while not botevents.check(botevents.BOT_LOADED): + pass + + # Verify channel and user exist + verify_channel(trigger) + verify_user(trigger) + botcom = class_create('botcom') if t_command_type == "nickname": @@ -167,6 +176,29 @@ def prerun_query(t_command_type='module', t_command_subtype=None): return actual_decorator +def verify_user(trigger): + # Identify + nick_id = botusers.whois_ident(trigger.nick) + # Verify nick is in the all list + botusers.add_to_all(trigger.nick, nick_id) + # Verify nick is in the all list + botusers.add_to_current(trigger.nick, nick_id) + # set current nick + botusers.mark_current_nick(trigger.nick, nick_id) + # add joined channel to nick list + botusers.add_channel(trigger.sender, nick_id) + # mark user as online + botusers.mark_user_online(nick_id) + + +def verify_channel(trigger): + botchannels.add_channel(trigger.sender) + # Identify + nick_id = botchannels.whois_ident(trigger.nick) + # Verify nick is in the channel list + botchannels.add_to_channel(trigger.sender, trigger.nick, nick_id) + + def make_trigger_args(triggerargs_one, trigger_command_type='module'): trigger_args = spicemanip.main(triggerargs_one, 'create') if trigger_command_type in ['nickname']: diff --git a/sopel_modules/SpiceBot/Users.py b/sopel_modules/SpiceBot/Users.py index ba393f9..c55c1e8 100644 --- a/sopel_modules/SpiceBot/Users.py +++ b/sopel_modules/SpiceBot/Users.py @@ -19,6 +19,7 @@ import re class BotUsers(): def __init__(self): + self.who_reqs = {} self.lock = threading.Lock() # TODO AWAY self.dict = { diff --git a/sopel_modules/SpiceBot/__init__.py b/sopel_modules/SpiceBot/__init__.py index 4b94555..7826238 100644 --- a/sopel_modules/SpiceBot/__init__.py +++ b/sopel_modules/SpiceBot/__init__.py @@ -5,6 +5,7 @@ These are the core SpiceBot Classes This module contains references only for other modules to utilize. """ +# pylama:ignore=W0401,W0611 from .Config import * from .Logs import * diff --git a/sopel_modules/SpiceBot/setup.py b/sopel_modules/SpiceBot/setup.py index 36a4c39..71c61ad 100644 --- a/sopel_modules/SpiceBot/setup.py +++ b/sopel_modules/SpiceBot/setup.py @@ -9,7 +9,7 @@ import os from .Config import config as botconfig from .Logs import logs -from .Events import events +from .Events import events as botevents from .Channels import SpiceBot_Channels_MainSection from .Commands import SpiceBot_Commands_MainSection @@ -73,19 +73,19 @@ def setup_config(bot): def setup_logs(bot): logs.log('SpiceBot_Logs', "Starting Setup Procedure") - events.startup_add([events.BOT_LOGS]) + botevents.startup_add([botevents.BOT_LOGS]) bot.config.core.logs_stdio = os.path.join(bot.config.core.logdir, 'stdio.log') # bot.config.core.logs_stdio = os.path.os.path.join(bot.config.core.logdir, bot.config.core.basename + '.stdio.log') bot.config.core.logs_exceptions = os.path.join(bot.config.core.logdir, 'exceptions.log') # bot.config.core.logs_exceptions = os.path.os.path.join(bot.config.core.logdir, bot.config.core.basename + '.exceptions.log') bot.config.core.logs_raw = os.path.join(bot.config.core.logdir, 'raw.log') # bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.core.basename + '.raw.log') - events.trigger(bot, events.BOT_LOGS, "SpiceBot_Logs") + botevents.trigger(bot, botevents.BOT_LOGS, "SpiceBot_Logs") def setup_commands(bot): logs.log('SpiceBot_Commands', "Setting Up Configuration") - events.startup_add([events.BOT_COMMANDS]) + botevents.startup_add([botevents.BOT_COMMANDS]) bot.config.define_section("SpiceBot_Commands", SpiceBot_Commands_MainSection, validate=False) bot.config.core.query_list = str(bot.config.SpiceBot_Commands.query_prefix).replace("\\", '').split("|") bot.config.core.prefix_list.extend(bot.config.SpiceBot_Commands.query_prefix) @@ -98,17 +98,17 @@ def setup_google(bot): def setup_startupmonologue(bot): logs.log('SpiceBot_StartupMonologue', "Initial Setup processing") - events.startup_add([ - events.BOT_STARTUPMONOLOGUE_CONNECTED, - events.BOT_STARTUPMONOLOGUE_CHANNELS, - events.BOT_STARTUPMONOLOGUE_COMMANDS, - events.BOT_STARTUPMONOLOGUE_AI, + botevents.startup_add([ + botevents.BOT_STARTUPMONOLOGUE_CONNECTED, + botevents.BOT_STARTUPMONOLOGUE_CHANNELS, + botevents.BOT_STARTUPMONOLOGUE_COMMANDS, + botevents.BOT_STARTUPMONOLOGUE_AI, ]) def setup_channels(bot): logs.log('SpiceBot_Channels', "Setting Up Configuration") - events.startup_add([events.BOT_CHANNELS]) + botevents.startup_add([botevents.BOT_CHANNELS]) bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) @@ -122,7 +122,7 @@ def setup_ai(bot): logs.log('SpiceBot_AI', "Setting Up Configuration") bot.config.define_section("SpiceBot_AI", SpiceBot_AI_MainSection, validate=False) bot.config.aibrain = os.path.join(bot.config.homedir, bot.config.core.basename + '.aibrain.brn') - events.startup_add([events.BOT_AI]) + botevents.startup_add([botevents.BOT_AI]) def setup_osd(bot): diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/advertisments.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/advertisments.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/advertisments.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/advertisments.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/ass.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/ass.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/ass.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/ass.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bacon.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bacon.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bacon.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bacon.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bitch.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bitch.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bitch.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bitch.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bull.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bull.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/bull.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/bull.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/comcast.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/comcast.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/comcast.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/comcast.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/confucius.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/confucius.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/confucius.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/confucius.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/dj.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/dj.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/dj.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/dj.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/fix.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/fix.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/fix.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/fix.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/fortune_cookie.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/fortune_cookie.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/fortune_cookie.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/fortune_cookie.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/guess.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/guess.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/guess.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/guess.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/hacks.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/hacks.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/hacks.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/hacks.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/helpbot.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/helpbot.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/helpbot.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/helpbot.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/hg.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/hg.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/hg.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/hg.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/husband.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/husband.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/husband.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/husband.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/lifehacks.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/lifehacks.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/lifehacks.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/lifehacks.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/lofl.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/lofl.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/lofl.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/lofl.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/maybe.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/maybe.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/maybe.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/maybe.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/me.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/me.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/me.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/me.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/moviequotes.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/moviequotes.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/moviequotes.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/moviequotes.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/no.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/no.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/no.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/no.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/oaf.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/oaf.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/oaf.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/oaf.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/paygrade.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/paygrade.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/paygrade.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/paygrade.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/phish.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/phish.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/phish.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/phish.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/relationship.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/relationship.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/relationship.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/relationship.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/solution.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/solution.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/solution.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/solution.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/techsupport.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/techsupport.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/techsupport.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/techsupport.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/til.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/til.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/til.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/til.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/uselessfacts.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/uselessfacts.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/uselessfacts.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/uselessfacts.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/webmd.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/webmd.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/webmd.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/webmd.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/wife.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/wife.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/wife.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/wife.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/world.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/world.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/world.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/world.json diff --git a/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/yes.json b/sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/yes.json similarity index 100% rename from sopel_modules/SpiceBot_Configs/SpiceBot_DictComs_old/sayings/yes.json rename to sopel_modules/SpiceBot_Configs/SpiceBot_DictComs/sayings/yes.json diff --git a/sopel_modules/SpiceBot_Core_Commands/AI.py b/sopel_modules/SpiceBot_Core_Commands/AI.py index 98b6fce..a04f7b8 100644 --- a/sopel_modules/SpiceBot_Core_Commands/AI.py +++ b/sopel_modules/SpiceBot_Core_Commands/AI.py @@ -18,6 +18,7 @@ def ai_trigger(bot, trigger, botcom): bot.osd(displayval) +@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED]) @sopel.module.rule('(.*)') def bot_command_rule_ai(bot, trigger): diff --git a/sopel_modules/SpiceBot_Core_Commands/Channels.py b/sopel_modules/SpiceBot_Core_Commands/Channels.py index 585155b..e7c0814 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Channels.py +++ b/sopel_modules/SpiceBot_Core_Commands/Channels.py @@ -10,7 +10,6 @@ import spicemanip import sopel_modules.SpiceBot as SpiceBot -@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED]) @SpiceBot.prerun('nickname') @sopel.module.nickname_commands('channels', 'channel') def nickname_comand_channels(bot, trigger, botcom): diff --git a/sopel_modules/SpiceBot_Core_Commands/Commands.py b/sopel_modules/SpiceBot_Core_Commands/Commands.py index ce7c5f9..195706c 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Commands.py +++ b/sopel_modules/SpiceBot_Core_Commands/Commands.py @@ -14,7 +14,6 @@ import sopel_modules.SpiceBot as SpiceBot # TODO commands sent in privmsg don't need bot.nick -@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) @SpiceBot.prerun('nickname') @sopel.module.nickname_commands('commands', 'command') def nickname_comand_commands(bot, trigger, botcom): diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index 2732765..3091f31 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -18,7 +18,6 @@ def query_trigger(bot, trigger, botcom): bot.osd("I have been programmed to help find new commands by using `?`.") -@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) @SpiceBot.prerun_query('nickname', 'nickname') @sopel.module.nickname_commands('(.*)') def query_detection_nick(bot, trigger, botcom): @@ -84,7 +83,6 @@ def query_detection_nick(bot, trigger, botcom): bot.osd("The following " + bot.nick + " commands start with " + str(trigger.sb['com']) + ": " + spicemanip.main(commandlist, 'andlist') + ".", trigger.nick, 'notice') -@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) @SpiceBot.prerun_query('module', 'module') @sopel.module.rule('^\?(.*)') def query_detection(bot, trigger, botcom): diff --git a/sopel_modules/SpiceBot_Core_Commands/Database.py b/sopel_modules/SpiceBot_Core_Commands/Database.py index c4773a5..8a811e8 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Database.py +++ b/sopel_modules/SpiceBot_Core_Commands/Database.py @@ -10,6 +10,7 @@ import sopel.module import sopel_modules.SpiceBot as SpiceBot +@SpiceBot.prerun('nickname') @sopel.module.nickname_commands('database') def bot_command_database(bot, trigger): bot.osd("Database is " + SpiceBot.config.db_type) diff --git a/sopel_modules/SpiceBot_Core_Commands/Docs.py b/sopel_modules/SpiceBot_Core_Commands/Docs.py index 8895123..9e9090f 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Docs.py +++ b/sopel_modules/SpiceBot_Core_Commands/Docs.py @@ -7,10 +7,13 @@ import sopel.module import sopel_modules.SpiceBot as SpiceBot +@SpiceBot.prerun('nickname') @sopel.module.nickname_commands('help', 'docs', 'wiki') def bot_command_docs(bot, trigger): - bot.osd(["IRC Modules Repository", - str(SpiceBot.github_dict["url_main"] + - SpiceBot.github_dict["repo_owner"] + "/" + - SpiceBot.github_dict["repo_name"] + - SpiceBot.github_dict["url_path_wiki"])]) + sb_git_url = str( + SpiceBot.github_dict["url_main"] + + SpiceBot.github_dict["repo_owner"] + "/" + + SpiceBot.github_dict["repo_name"] + + SpiceBot.github_dict["url_path_wiki"] + ) + bot.osd(["IRC Modules Repository", sb_git_url]) diff --git a/sopel_modules/SpiceBot_Core_Commands/Logs.py b/sopel_modules/SpiceBot_Core_Commands/Logs.py index 8a36396..2046ffb 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Logs.py +++ b/sopel_modules/SpiceBot_Core_Commands/Logs.py @@ -12,7 +12,6 @@ import spicemanip import sopel_modules.SpiceBot as SpiceBot -@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOGS]) @SpiceBot.prerun('nickname') @sopel.module.nickname_commands('logs', 'debug') def bot_command_logs(bot, trigger, botcom): diff --git a/sopel_modules/SpiceBot_Core_Commands/Reddit.py b/sopel_modules/SpiceBot_Core_Commands/Reddit.py index 785e2b5..9e91aec 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Reddit.py +++ b/sopel_modules/SpiceBot_Core_Commands/Reddit.py @@ -7,16 +7,23 @@ import sopel.module import sopel_modules.SpiceBot as SpiceBot +@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED]) @sopel.module.rule(r"""(?:)u/ ( (?:\\/ | [^/])+ ) """) +def bot_command_reddit_user(bot, trigger): + message = SpiceBot.reddit.prerun(trigger) + bot.osd(message) + + +@SpiceBot.events.check_ready([SpiceBot.events.BOT_LOADED]) @sopel.module.rule(r"""(?:)r/ ( (?:\\/ | [^/])+ ) """) -def bot_command_reddit_syntax(bot, trigger): +def bot_command_reddit_subreddit(bot, trigger): message = SpiceBot.reddit.prerun(trigger) bot.osd(message) diff --git a/sopel_modules/SpiceBot_Core_Commands/__init__.py b/sopel_modules/SpiceBot_Core_Commands/__init__.py index 468cf8b..128d453 100644 --- a/sopel_modules/SpiceBot_Core_Commands/__init__.py +++ b/sopel_modules/SpiceBot_Core_Commands/__init__.py @@ -5,6 +5,7 @@ These are the core SpiceBot Classes This module contains references only for other modules to utilize. """ +# pylama:ignore=W0401,W0611 from .CommandsQuery import * from .Commands import * diff --git a/sopel_modules/SpiceBot_Core_Processing/__init__.py b/sopel_modules/SpiceBot_Core_Processing/__init__.py index 95788bd..ed8f775 100644 --- a/sopel_modules/SpiceBot_Core_Processing/__init__.py +++ b/sopel_modules/SpiceBot_Core_Processing/__init__.py @@ -5,6 +5,7 @@ These are the core SpiceBot Classes This module contains references only for other modules to utilize. """ +# pylama:ignore=W0401,W0611 from .Channels import * from .Users import * diff --git a/sopel_modules/SpiceBot_SopelPatches/__init__.py b/sopel_modules/SpiceBot_SopelPatches/__init__.py index 0232bc1..076aae5 100644 --- a/sopel_modules/SpiceBot_SopelPatches/__init__.py +++ b/sopel_modules/SpiceBot_SopelPatches/__init__.py @@ -1,5 +1,6 @@ # coding=utf8 from __future__ import unicode_literals, absolute_import, division, print_function +# pylama:ignore=W0401,W0611 from .Patches import *