aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar decorator-factory <[email protected]>2025-04-06 17:03:58 +0300
committerGravatar GitHub <[email protected]>2025-04-06 15:03:58 +0100
commit479df30cef329fc09baebad82e4e7c9f77c3c18f (patch)
tree7d3039cb7024c99dc8cd7c7ae30d629da968603d
parentMerge pull request #3306 from python-discord/remove-ping-on-auto-ban (diff)
Remove unused `ValidDiscordServerInvite` converter (#3307)
-rw-r--r--bot/converters.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/bot/converters.py b/bot/converters.py
index c04158d4d..ecfcb1b4d 100644
--- a/bot/converters.py
+++ b/bot/converters.py
@@ -13,10 +13,8 @@ from discord.ext.commands import BadArgument, Context, Converter, IDConverter, M
from discord.utils import snowflake_time
from pydis_core.site_api import ResponseCodeError
from pydis_core.utils import unqualify
-from pydis_core.utils.regex import DISCORD_INVITE
from bot import exts, instance as bot_instance
-from bot.constants import URLs
from bot.errors import InvalidInfractionError
from bot.exts.info.doc import _inventory_parser
from bot.log import get_logger
@@ -31,42 +29,6 @@ DISCORD_EPOCH_DT = snowflake_time(0)
RE_USER_MENTION = re.compile(r"<@!?([0-9]+)>$")
-class ValidDiscordServerInvite(Converter):
- """
- A converter that validates whether a given string is a valid Discord server invite.
-
- Raises 'BadArgument' if:
- - The string is not a valid Discord server invite.
- - The string is valid, but is an invite for a group DM.
- - The string is valid, but is expired.
-
- Returns a (partial) guild object if:
- - The string is a valid vanity
- - The string is a full invite URI
- - The string contains the invite code (the stuff after discord.gg/)
-
- See the Discord API docs for documentation on the guild object:
- https://discord.com/developers/docs/resources/guild#guild-object
- """
-
- async def convert(self, ctx: Context, server_invite: str) -> dict:
- """Check whether the string is a valid Discord server invite."""
- invite_code = DISCORD_INVITE.match(server_invite)
- if invite_code:
- response = await ctx.bot.http_session.get(
- f"{URLs.discord_invite_api}/{invite_code.group('invite')}"
- )
- if response.status != 404:
- invite_data = await response.json()
- return invite_data.get("guild")
-
- id_converter = IDConverter()
- if id_converter._get_id_match(server_invite):
- raise BadArgument("Guild IDs are not supported, only invites.")
-
- raise BadArgument("This does not appear to be a valid Discord server invite.")
-
-
class Extension(Converter):
"""
Fully qualify the name of an extension and ensure it exists.
@@ -466,7 +428,6 @@ class Infraction(Converter):
if t.TYPE_CHECKING:
- ValidDiscordServerInvite = dict
ValidFilterListType = str
Extension = str
PackageName = str