Move bot_in_a_guild from redbot.core.checks to redbot.core.commands (#4515)

This commit is contained in:
PredaaA
2020-10-22 10:58:18 +02:00
committed by GitHub
parent e1226c6c88
commit b8a2cf3f91
3 changed files with 23 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import discord
from .commands import (
bot_has_permissions,
bot_in_a_guild,
has_permissions,
is_owner,
guildowner,
@@ -13,7 +14,6 @@ from .commands import (
admin_or_permissions,
mod,
mod_or_permissions,
check as _check_decorator,
)
from .utils.mod import (
is_mod_or_superior as _is_mod_or_superior,
@@ -27,6 +27,7 @@ if TYPE_CHECKING:
__all__ = [
"bot_has_permissions",
"bot_in_a_guild",
"has_permissions",
"is_owner",
"guildowner",
@@ -37,20 +38,10 @@ __all__ = [
"mod_or_permissions",
"is_mod_or_superior",
"is_admin_or_superior",
"bot_in_a_guild",
"check_permissions",
]
def bot_in_a_guild():
"""Deny the command if the bot is not in a guild."""
async def predicate(ctx):
return len(ctx.bot.guilds) > 0
return _check_decorator(predicate)
def is_mod_or_superior(ctx: "Context") -> Awaitable[bool]:
warnings.warn(
"`redbot.core.checks.is_mod_or_superior` is deprecated and will be removed in a future "