mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Add checks submodule to redbot.core.app_commands (#6107)
This commit is contained in:
parent
4edf975996
commit
6a53d7dcd5
@ -60,6 +60,8 @@ from discord.app_commands import (
|
|||||||
rename as rename,
|
rename as rename,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from . import checks as checks
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"AllChannels",
|
"AllChannels",
|
||||||
"AppCommand",
|
"AppCommand",
|
||||||
@ -112,4 +114,5 @@ __all__ = (
|
|||||||
"guilds",
|
"guilds",
|
||||||
"locale_str",
|
"locale_str",
|
||||||
"rename",
|
"rename",
|
||||||
|
"checks",
|
||||||
)
|
)
|
||||||
|
|||||||
25
redbot/core/app_commands/checks.py
Normal file
25
redbot/core/app_commands/checks.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
########## SENSITIVE SECTION WARNING ###########
|
||||||
|
################################################
|
||||||
|
# Any edits of any of the exported names #
|
||||||
|
# may result in a breaking change. #
|
||||||
|
# Ensure no names are removed without warning. #
|
||||||
|
################################################
|
||||||
|
|
||||||
|
### DEP-WARN: Check this *every* discord.py update
|
||||||
|
from discord.app_commands.checks import (
|
||||||
|
bot_has_permissions,
|
||||||
|
cooldown,
|
||||||
|
dynamic_cooldown,
|
||||||
|
has_any_role,
|
||||||
|
has_role,
|
||||||
|
has_permissions,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"bot_has_permissions",
|
||||||
|
"cooldown",
|
||||||
|
"dynamic_cooldown",
|
||||||
|
"has_any_role",
|
||||||
|
"has_role",
|
||||||
|
"has_permissions",
|
||||||
|
)
|
||||||
@ -21,3 +21,14 @@ def test_dpy_app_commands_reexports():
|
|||||||
"redbot.core.app_commands is missing these names from discord.app_commands: "
|
"redbot.core.app_commands is missing these names from discord.app_commands: "
|
||||||
+ ", ".join(missing_attrs)
|
+ ", ".join(missing_attrs)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_dpy_app_commands_checks_reexports():
|
||||||
|
dpy_attrs = set(dpy_app_commands.checks.__all__)
|
||||||
|
missing_attrs = dpy_attrs - set(app_commands.checks.__dict__.keys())
|
||||||
|
|
||||||
|
if missing_attrs:
|
||||||
|
pytest.fail(
|
||||||
|
"redbot.core.app_commands.checks is missing these names from discord.app_commands: "
|
||||||
|
+ ", ".join(missing_attrs)
|
||||||
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user