Skip to content

Commit

Permalink
Fix @commands.can_manage_channel always passing (#6398)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flame442 authored Jul 10, 2024
1 parent 2b1e603 commit 0b0b23b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions redbot/core/commands/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def decorator(func: _T) -> _T:


def _can_manage_channel_deco(
privilege_level: Optional[PrivilegeLevel] = None, allow_thread_owner: bool = False
*, privilege_level: Optional[PrivilegeLevel] = None, allow_thread_owner: bool = False
) -> Callable[[_T], _T]:
async def predicate(ctx: "Context") -> bool:
if utils.can_user_manage_channel(
Expand Down Expand Up @@ -803,7 +803,7 @@ def can_manage_channel(*, allow_thread_owner: bool = False) -> Callable[[_T], _T
as that, in addition to members with manage channel/threads permission,
can also be done by the thread owner.
"""
return _can_manage_channel_deco(allow_thread_owner)
return _can_manage_channel_deco(allow_thread_owner=allow_thread_owner)


def is_owner():
Expand Down Expand Up @@ -837,7 +837,9 @@ def guildowner_or_can_manage_channel(*, allow_thread_owner: bool = False) -> Cal
as that, in addition to members with manage channel/threads permission,
can also be done by the thread owner.
"""
return _can_manage_channel_deco(PrivilegeLevel.GUILD_OWNER, allow_thread_owner)
return _can_manage_channel_deco(
privilege_level=PrivilegeLevel.GUILD_OWNER, allow_thread_owner=allow_thread_owner
)


def guildowner():
Expand Down Expand Up @@ -871,7 +873,9 @@ def admin_or_can_manage_channel(*, allow_thread_owner: bool = False) -> Callable
as that, in addition to members with manage channel/threads permission,
can also be done by the thread owner.
"""
return _can_manage_channel_deco(PrivilegeLevel.ADMIN, allow_thread_owner)
return _can_manage_channel_deco(
privilege_level=PrivilegeLevel.ADMIN, allow_thread_owner=allow_thread_owner
)


def admin():
Expand Down Expand Up @@ -905,7 +909,9 @@ def mod_or_can_manage_channel(*, allow_thread_owner: bool = False) -> Callable[[
as that, in addition to members with manage channel/threads permission,
can also be done by the thread owner.
"""
return _can_manage_channel_deco(PrivilegeLevel.MOD, allow_thread_owner)
return _can_manage_channel_deco(
privilege_level=PrivilegeLevel.MOD, allow_thread_owner=allow_thread_owner
)


def mod():
Expand Down

0 comments on commit 0b0b23b

Please sign in to comment.