WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
5 changed files with 25 additions and 5 deletions
Showing only changes of commit 4ec065e438 - Show all commits

View file

@ -1,4 +1,5 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from redbot.core.utils.chat_formatting import error from redbot.core.utils.chat_formatting import error
@ -14,7 +15,10 @@ class Addrole(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): 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) @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): 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 import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..utilities.config import config from ..utilities.config import config
@ -14,7 +15,10 @@ class Guild(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): 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) @ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument 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 import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from redbot.core.utils.chat_formatting import error from redbot.core.utils.chat_formatting import error
@ -14,7 +15,10 @@ class Immune(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): 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) @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): 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 import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..utilities.config import config from ..utilities.config import config
@ -14,7 +15,10 @@ class Overrides(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): 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) @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 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 import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..models.type import Type from ..models.type import Type
@ -15,7 +16,10 @@ class Types(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): 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) @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 async def show_in_history(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument