Reinforced reaction_message management and interaction, better split responsibilty of tasks across files and functions.

UUID is now used as primary key for reaction_messages.
This commit is contained in:
DefsNotQuack
2025-03-30 17:34:47 +10:00
parent e00d1fdce3
commit 30bab81007
8 changed files with 389 additions and 286 deletions

30
cogs/setup.py Normal file
View File

@@ -0,0 +1,30 @@
import os
import discord
from discord.ext import commands
from data import react_roles
from util.console import console, panel, track_iterable as track
GUILD_IDS = [int(os.getenv("DEV_GUILD_ID"))]
class Setup(commands.Cog):
def __init__(self, bot):
self.bot = bot
### COMMANDS ###
@commands.slash_command(name="instantiate_server", description="Instantiate the server.", guild_ids=GUILD_IDS)
@commands.has_permissions(manage_guild=True)
async def instantiate_server(self, ctx: discord.ApplicationContext):
"""
Command to instantiate the server.
This command creates the necessary database tables and initializes the server.
"""
# Add guild to the database
react_roles.check_and_add_guild(ctx.guild_id, ctx.guild.name)
console.log(f"[green]Guild - {ctx.guild.name} - added to the database.[/green]")
await ctx.respond(f"Server '{ctx.guild.name}' instantiated successfully!", ephemeral=True)
def setup(bot):
bot.add_cog(Setup(bot))