This commit is contained in:
deathbybandaid 2022-02-10 13:53:45 -05:00
parent 4267b5b6ca
commit 981eb37f22
10 changed files with 34 additions and 17 deletions

View File

@ -1,10 +1,11 @@
from .interface.config import Config from .config import Config
from .interface.versions import Versions from .versions import Versions
from .interface.logger import Logger from .logger import Logger
from .interface.database import Database from .database import Database
from .interface.comms import Comms from .comms import Comms
from .interface.events import Events from .events import Events
from .commands import Commands
class SpiceBotCore_OBJ(): class SpiceBotCore_OBJ():
@ -38,6 +39,10 @@ class SpiceBotCore_OBJ():
self.comms = Comms(self.config) self.comms = Comms(self.config)
self.logger.info("SpiceBot Comms Interface Setup Complete.") self.logger.info("SpiceBot Comms Interface Setup Complete.")
# SpiceBots access to Sopel Command listing
self.commands = Commands(self.logger)
self.logger.info("SpiceBot Commands Interface Setup Complete.")
def setup(self, bot): def setup(self, bot):
"""This runs with the plugin setup routine""" """This runs with the plugin setup routine"""
@ -47,6 +52,9 @@ class SpiceBotCore_OBJ():
# Re-initialize the bot config properly during plugin setup routine # Re-initialize the bot config properly during plugin setup routine
self.config.config = bot.config self.config.config = bot.config
# Give Spicebot access to bot commands
self.commands.bot = bot
# OSD shortcut # OSD shortcut
def osd(self, messages, recipients=None, text_method='PRIVMSG', max_messages=-1): def osd(self, messages, recipients=None, text_method='PRIVMSG', max_messages=-1):
return self.comms.osd(messages, recipients, text_method, max_messages) return self.comms.osd(messages, recipients, text_method, max_messages)

View File

@ -0,0 +1,19 @@
import bot
class Commands():
def __init__(self):
self.bot = None
@property
def sopel_commands(self):
return bot.rules.get_all_commands()
@property
def sopel_nickname_commands(self):
return bot.rules.get_all_nick_commands()
@property
def sopel_action_commands(self):
return bot.rules.get_all_action_commands()

View File

@ -34,9 +34,6 @@ def prerun_nickname_command():
# Primary command used for trigger, and a list of all words # Primary command used for trigger, and a list of all words
trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type)
for x in [trigger_args, trigger_command, trigger_prefix]:
bot.say(str(x))
function(bot, trigger, *args, **kwargs) function(bot, trigger, *args, **kwargs)
return internal_prerun return internal_prerun

View File

@ -20,12 +20,5 @@ def sb_nickname_command(bot, trigger):
@prerun_nickname_command() @prerun_nickname_command()
@plugin.nickname_command('fart') @plugin.nickname_command('fart')
def sb_fart_command(bot, trigger): def sb_fart_command(bot, trigger):
bot.say("Testing the bot")
bot.say("Attributes: %s" % [x for x in dir(sb) if not x.startswith("__")])
bot.say("%s" % sb.versions.dict)
sb.osd("test", trigger.sender) bot.say(str(sb.commands.sopel_commands))
bot.say(str(bot.rules.get_all_commands()))
bot.say(str(bot.rules.get_all_nick_commands()))
bot.say(str(bot.rules.get_all_action_commands()))