diff --git a/cogs/system/features.py b/cogs/system/features.py index 1b3d3871d..22012b37a 100644 --- a/cogs/system/features.py +++ b/cogs/system/features.py @@ -33,7 +33,7 @@ def get_all_cogs() -> list[tuple[str, str]]: return sorted(all_cogs) -async def split_cogs() -> list[tuple[str, str]]: +async def split_cogs() -> list[list[tuple[str, str]]]: """Slices list of all cogs to chunks for select. Returns: diff --git a/cogs/system/views.py b/cogs/system/views.py index 1ba156f49..ac35937d3 100644 --- a/cogs/system/views.py +++ b/cogs/system/views.py @@ -9,12 +9,12 @@ class View(BaseView): - def __init__(self, bot: commands.Bot, cogs: list[str]): + def __init__(self, bot: commands.Bot, cogs: list[list[tuple[str, str]]]): super().__init__() self.bot = bot self.count = len(cogs) self.cogs = cogs - self.message = None + self.message: disnake.Message self.selects = [] for i in range(self.count): @@ -36,7 +36,10 @@ async def reload_button(self, button: disnake.ui.Button, inter: disnake.MessageI await inter.response.edit_message(view=self) async def on_timeout(self) -> None: - await self.message.edit(view=None) + try: + await self.message.edit(view=None) + except Exception: + pass async def interaction_check(self, inter: disnake.Interaction) -> bool: if permission_check.is_bot_admin(inter): @@ -45,12 +48,12 @@ async def interaction_check(self, inter: disnake.Interaction) -> bool: class Dropdown(disnake.ui.Select): - def __init__(self, bot: commands.Bot, view: View, cogs: list[str]): + def __init__(self, bot: commands.Bot, view: View, cogs: list[tuple[str, str]]): self.bot = bot self._view = view - self.cogs = cogs + self.cogs: list[tuple[str, str]] = cogs self.reload = False - self.message = None + self.message: disnake.Message self.unloadable_cogs = ["system"] super().__init__(