fix(aurora): fixed a NotFound error being thrown to the console

This commit is contained in:
Seaswimmer 2024-08-12 20:40:10 -04:00
parent 7c8aaba309
commit 4ec065e438
Signed by: cswimr
GPG key ID: 3813315477F26F82
5 changed files with 25 additions and 5 deletions

View file

@ -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):

View file

@ -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

View file

@ -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):

View file

@ -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

View file

@ -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