runabot/Christmas/Cogs/Commands_Util.py
2023-11-26 13:27:34 +09:00

25 lines
859 B
Python

from discord import ApplicationContext, DiscordException, slash_command
from discord.ext.commands import Cog, cooldown, BucketType, has_permissions, guild_only, Context
from Christmas.UI.Embed import Default_Embed
from Christmas.Database import database
class CUtil(Cog):
def __init__(self, bot):
self.bot = bot
@guild_only()
@has_permissions(administrator=True)
@cooldown(1, 10, BucketType.user)
@slash_command(name="서버가입", description="서버에 가입합니다.")
async def _join(self, ctx: Context):
try:
await database.register_guild(ctx.guild.id)
await ctx.respond(embed=Default_Embed.register_sucess())
except Exception as e:
await ctx.respond(embed=Default_Embed.register_failed())
def setup(bot):
bot.add_cog(CUtil(bot))