This commit is contained in:
tmddn3070 2023-12-11 02:25:45 +09:00
parent 8bed6ca308
commit d793cb2930
3 changed files with 13 additions and 6 deletions

View File

@ -27,12 +27,9 @@ class CUtil(Cog):
@cooldown(1, 10, BucketType.user) @cooldown(1, 10, BucketType.user)
@slash_command(name="서버탈퇴", description="서버에서 탈퇴합니다.") @slash_command(name="서버탈퇴", description="서버에서 탈퇴합니다.")
async def _leave(self, ctx: Context): async def _leave(self, ctx: Context):
try: if not await database.get_guild(ctx.guild.id): return await ctx.respond(embed=Default_Embed.not_register(), ephemeral=True)
if not await database.get_guild(ctx.guild.id): return await ctx.respond(embed=Default_Embed.not_register(), ephemeral=True) await database.leave_guild(ctx.guild.id)
#await database.leave_guild(ctx.guild.id) await ctx.respond(embed=Default_Embed.leave_sucess())
await ctx.respond(embed=Default_Embed.leave_sucess())
except Exception as e:
await ctx.respond(embed=Default_Embed.leave_failed())
@guild_only() @guild_only()

View File

@ -20,6 +20,9 @@ class database:
async def register_guild(guild_id: int) -> None: async def register_guild(guild_id: int) -> None:
conn = await MongoDBClient().connect() conn = await MongoDBClient().connect()
await conn.guild.insert_one({"_id": guild_id, "admin_run": False, "music": True}) await conn.guild.insert_one({"_id": guild_id, "admin_run": False, "music": True})
async def leave_guild(guild_id: int) -> None:
conn = await MongoDBClient().connect()
await conn.guild.delete_one({"_id": guild_id})
async def insert_mail(send_user_id: int, user_id: int, user_name: str, mail_title: str, mail_content: str): async def insert_mail(send_user_id: int, user_id: int, user_name: str, mail_title: str, mail_content: str):
try: try:

View File

@ -69,6 +69,13 @@ class Default_Embed:
def cooldown(sec): def cooldown(sec):
return "이 명령어는 " + f"``{round(sec, 2)}``" + "초 뒤에 다시 사용할 수 있어요!" return "이 명령어는 " + f"``{round(sec, 2)}``" + "초 뒤에 다시 사용할 수 있어요!"
@staticmethod
def leave_sucess():
embed = ChristmasEmbed(title="🎉 탈퇴 성공!", description="서버에서 탈퇴했어요!")
embed.add_field(name="안내", value="크돌이를 이용해주셔서 감사해요!", inline=False)
embed.set_footer()
return embed
@staticmethod @staticmethod
def help(): def help():
embed = ChristmasEmbed(title="🎉 크돌이 도움말", description="크리스마스를 즐겨보세요!") embed = ChristmasEmbed(title="🎉 크돌이 도움말", description="크리스마스를 즐겨보세요!")