Skip to content

Commit

Permalink
mypy fix: system
Browse files Browse the repository at this point in the history
  • Loading branch information
solumath committed Apr 4, 2024
1 parent ada88b9 commit 0f5d3da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cogs/system/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 9 additions & 6 deletions cogs/system/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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__(
Expand Down

0 comments on commit 0f5d3da

Please sign in to comment.