Skip to content

Commit

Permalink
fix(cog): fix typing of cog check methods (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snipy7374 authored Aug 31, 2024
1 parent 0a5ab1e commit 2206241
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions disnake/ext/commands/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

from disnake.interactions import ApplicationCommandInteraction

from ._types import MaybeCoro
from .bot import AutoShardedBot, AutoShardedInteractionBot, Bot, InteractionBot
from .context import Context
from .core import Command
Expand Down Expand Up @@ -491,7 +492,7 @@ def cog_unload(self) -> None:
pass

@_cog_special_method
def bot_check_once(self, ctx: Context) -> bool:
def bot_check_once(self, ctx: Context) -> MaybeCoro[bool]:
"""A special method that registers as a :meth:`.Bot.check_once`
check.
Expand All @@ -503,7 +504,7 @@ def bot_check_once(self, ctx: Context) -> bool:
return True

@_cog_special_method
def bot_check(self, ctx: Context) -> bool:
def bot_check(self, ctx: Context) -> MaybeCoro[bool]:
"""A special method that registers as a :meth:`.Bot.check`
check.
Expand All @@ -515,7 +516,7 @@ def bot_check(self, ctx: Context) -> bool:
return True

@_cog_special_method
def bot_slash_command_check_once(self, inter: ApplicationCommandInteraction) -> bool:
def bot_slash_command_check_once(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""A special method that registers as a :meth:`.Bot.slash_command_check_once`
check.
Expand All @@ -525,7 +526,7 @@ def bot_slash_command_check_once(self, inter: ApplicationCommandInteraction) ->
return True

@_cog_special_method
def bot_slash_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def bot_slash_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""A special method that registers as a :meth:`.Bot.slash_command_check`
check.
Expand All @@ -535,27 +536,29 @@ def bot_slash_command_check(self, inter: ApplicationCommandInteraction) -> bool:
return True

@_cog_special_method
def bot_user_command_check_once(self, inter: ApplicationCommandInteraction) -> bool:
def bot_user_command_check_once(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""Similar to :meth:`.Bot.slash_command_check_once` but for user commands."""
return True

@_cog_special_method
def bot_user_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def bot_user_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""Similar to :meth:`.Bot.slash_command_check` but for user commands."""
return True

@_cog_special_method
def bot_message_command_check_once(self, inter: ApplicationCommandInteraction) -> bool:
def bot_message_command_check_once(
self, inter: ApplicationCommandInteraction
) -> MaybeCoro[bool]:
"""Similar to :meth:`.Bot.slash_command_check_once` but for message commands."""
return True

@_cog_special_method
def bot_message_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def bot_message_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""Similar to :meth:`.Bot.slash_command_check` but for message commands."""
return True

@_cog_special_method
def cog_check(self, ctx: Context) -> bool:
def cog_check(self, ctx: Context) -> MaybeCoro[bool]:
"""A special method that registers as a :func:`~.check`
for every text command and subcommand in this cog.
Expand All @@ -567,7 +570,7 @@ def cog_check(self, ctx: Context) -> bool:
return True

@_cog_special_method
def cog_slash_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def cog_slash_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""A special method that registers as a :func:`~.check`
for every slash command and subcommand in this cog.
Expand All @@ -577,12 +580,12 @@ def cog_slash_command_check(self, inter: ApplicationCommandInteraction) -> bool:
return True

@_cog_special_method
def cog_user_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def cog_user_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""Similar to :meth:`.Cog.cog_slash_command_check` but for user commands."""
return True

@_cog_special_method
def cog_message_command_check(self, inter: ApplicationCommandInteraction) -> bool:
def cog_message_command_check(self, inter: ApplicationCommandInteraction) -> MaybeCoro[bool]:
"""Similar to :meth:`.Cog.cog_slash_command_check` but for message commands."""
return True

Expand Down

0 comments on commit 2206241

Please sign in to comment.