From 4ec065e43866e12cde1f8409b11343f969a5d808 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Mon, 12 Aug 2024 20:40:10 -0400 Subject: [PATCH] fix(aurora): fixed a NotFound error being thrown to the console --- aurora/menus/addrole.py | 6 +++++- aurora/menus/guild.py | 6 +++++- aurora/menus/immune.py | 6 +++++- aurora/menus/overrides.py | 6 +++++- aurora/menus/types.py | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/aurora/menus/addrole.py b/aurora/menus/addrole.py index 36c9056..ecf2941 100644 --- a/aurora/menus/addrole.py +++ b/aurora/menus/addrole.py @@ -1,4 +1,5 @@ from discord import ButtonStyle, Interaction, Message, ui +from discord.errors import NotFound from redbot.core import commands from redbot.core.utils.chat_formatting import error @@ -14,7 +15,10 @@ class Addrole(ui.View): self.timeout = timeout async def on_timeout(self): - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except NotFound: + pass @ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25) async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect): diff --git a/aurora/menus/guild.py b/aurora/menus/guild.py index 71186b7..5f54e6a 100644 --- a/aurora/menus/guild.py +++ b/aurora/menus/guild.py @@ -1,4 +1,5 @@ from discord import ButtonStyle, Interaction, Message, ui +from discord.errors import NotFound from redbot.core import commands from ..utilities.config import config @@ -14,7 +15,10 @@ class Guild(ui.View): self.timeout = timeout async def on_timeout(self): - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except NotFound: + pass @ui.button(label="Show Moderator", style=ButtonStyle.green, row=0) async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument diff --git a/aurora/menus/immune.py b/aurora/menus/immune.py index dd710b1..d6acc45 100644 --- a/aurora/menus/immune.py +++ b/aurora/menus/immune.py @@ -1,4 +1,5 @@ from discord import ButtonStyle, Interaction, Message, ui +from discord.errors import NotFound from redbot.core import commands from redbot.core.utils.chat_formatting import error @@ -14,7 +15,10 @@ class Immune(ui.View): self.timeout = timeout async def on_timeout(self): - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except NotFound: + pass @ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25) async def immune_select(self, interaction: Interaction, select: ui.RoleSelect): diff --git a/aurora/menus/overrides.py b/aurora/menus/overrides.py index 4327131..af2df00 100644 --- a/aurora/menus/overrides.py +++ b/aurora/menus/overrides.py @@ -1,4 +1,5 @@ from discord import ButtonStyle, Interaction, Message, ui +from discord.errors import NotFound from redbot.core import commands from ..utilities.config import config @@ -14,7 +15,10 @@ class Overrides(ui.View): self.timeout = timeout async def on_timeout(self): - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except NotFound: + pass @ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0) async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument diff --git a/aurora/menus/types.py b/aurora/menus/types.py index f943d90..52fc7e3 100644 --- a/aurora/menus/types.py +++ b/aurora/menus/types.py @@ -1,4 +1,5 @@ from discord import ButtonStyle, Interaction, Message, ui +from discord.errors import NotFound from redbot.core import commands from ..models.type import Type @@ -15,7 +16,10 @@ class Types(ui.View): self.timeout = timeout async def on_timeout(self): - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except NotFound: + pass @ui.button(label="Show in History", style=ButtonStyle.green, row=0) async def show_in_history(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument