mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Checks] Preserve backwards compatibility in deprecated functions (#2176)
* [checks] preserve backwards compatability * [checks] use correct ctx.author
This commit is contained in:
parent
93a0e45c34
commit
80506856fb
@ -51,22 +51,22 @@ def bot_in_a_guild():
|
|||||||
return _check_decorator(predicate)
|
return _check_decorator(predicate)
|
||||||
|
|
||||||
|
|
||||||
def is_mod_or_superior(bot: "Red", member: discord.Member) -> Awaitable[bool]:
|
def is_mod_or_superior(ctx: "Context") -> Awaitable[bool]:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"`redbot.core.checks.is_mod_or_superior` is deprecated and will be removed in a future "
|
"`redbot.core.checks.is_mod_or_superior` is deprecated and will be removed in a future "
|
||||||
"release, please use `redbot.core.utils.mod.is_mod_or_superior` instead.",
|
"release, please use `redbot.core.utils.mod.is_mod_or_superior` instead.",
|
||||||
category=DeprecationWarning,
|
category=DeprecationWarning,
|
||||||
)
|
)
|
||||||
return _is_mod_or_superior(bot, member)
|
return _is_mod_or_superior(ctx.bot, ctx.author)
|
||||||
|
|
||||||
|
|
||||||
def is_admin_or_superior(bot: "Red", member: discord.Member) -> Awaitable[bool]:
|
def is_admin_or_superior(ctx: "Context") -> Awaitable[bool]:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"`redbot.core.checks.is_admin_or_superior` is deprecated and will be removed in a future "
|
"`redbot.core.checks.is_admin_or_superior` is deprecated and will be removed in a future "
|
||||||
"release, please use `redbot.core.utils.mod.is_admin_or_superior` instead.",
|
"release, please use `redbot.core.utils.mod.is_admin_or_superior` instead.",
|
||||||
category=DeprecationWarning,
|
category=DeprecationWarning,
|
||||||
)
|
)
|
||||||
return _is_admin_or_superior(bot, member)
|
return _is_admin_or_superior(ctx.bot, ctx.author)
|
||||||
|
|
||||||
|
|
||||||
def check_permissions(ctx: "Context", perms: Dict[str, bool]) -> Awaitable[bool]:
|
def check_permissions(ctx: "Context", perms: Dict[str, bool]) -> Awaitable[bool]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user