Update message builder and add a test command.
build

This commit is contained in:
2023-07-01 22:05:18 -04:00
parent 8a48c193ab
commit d223a6b14e
4 changed files with 98 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
"""
Cog loader. Adds all command cogs to the bot.
"""
from nextcord.ext import commands
from cogs.commands.test import TestCog
# This function will be called when this extension is loaded.
# It is necessary to add these functions to the bot.
def setup(bot: commands.Bot):
"""
Adds all command classes to bot.
"""
bot.add_cog(TestCog(bot))
+40
View File
@@ -0,0 +1,40 @@
"""
Commands for testing.
"""
import nextcord
from nextcord.ext import commands
from bot_messages.message_builder import MessageBuilder
class TestCog(commands.Cog, name="Test commands."):
"""
Class holds commands for testing.
"""
def __init__(self, bot) -> None:
"""
Default constructor for HelpCog class. Does nothing.
"""
self.bot = bot
@nextcord.slash_command()
async def test(self, interaction: nextcord.Interaction):
"""
Parent slash command for help. Never called.
"""
@test.subcommand()
async def msg_builder(self, interaction: nextcord.Interaction):
"""
Tests the message builder.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
"""
msg_bulder = MessageBuilder(self.bot.config, 0)
message = msg_bulder.get_vote_start()
await interaction.channel.send(content=message)
-1
View File
@@ -24,7 +24,6 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
"""
Starts the loop when bot is ready.
"""
print("on ready")
await self.bot.wait_until_ready()
# pylint doesn't recognize that periodic_update_guild_data is subclassed from tasks.loop.
await self.do_thing.start() # pylint: disable=no-member