30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
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)) |