From a046ba54a0c0b38e63b1375921d08323dd0c83a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=88=84?= Date: Wed, 22 Mar 2023 13:04:57 +0000 Subject: [PATCH] show when error occurred --- bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 4f3eb6e..068e032 100644 --- a/bot.py +++ b/bot.py @@ -51,7 +51,11 @@ async def _addConnection(inter: disnake.ApplicationCommandInteraction): )) async with LinkedRolesOAuth2(client_id=os.getenv("CLIENT_ID"), token=os.getenv("BOT_TOKEN")) as client: - result = await client.register_role_metadata(records=tuple(records), force=True) - await inter.edit_original_message(content=str(result)) + try: + result = await client.register_role_metadata(records=tuple(records), force=True) + except Exception as e: + await inter.edit_original_message(content=f"연동에 실패했습니다.\n{e}") + else: + await inter.edit_original_message(content=str(result)) bot.run(os.getenv("BOT_TOKEN")) \ No newline at end of file