From d7a3da49f0dab0b9bd22cb767006ff225eaa0a0d Mon Sep 17 00:00:00 2001 From: Dav Date: Sun, 17 Jan 2021 23:42:00 +0100 Subject: [PATCH] [Mod] Make tempban not fail if no vanity url is set up (#4714) * catch if a vanity url is not set up * black Co-authored-by: David Bauch --- redbot/cogs/mod/kickban.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redbot/cogs/mod/kickban.py b/redbot/cogs/mod/kickban.py index 3a52dd691..e843bff58 100644 --- a/redbot/cogs/mod/kickban.py +++ b/redbot/cogs/mod/kickban.py @@ -39,7 +39,14 @@ class KickBanMixin(MixinMeta): if my_perms.manage_guild or my_perms.administrator: if "VANITY_URL" in guild.features: # guild has a vanity url so use it as the one to send - return await guild.vanity_invite() + try: + return await guild.vanity_invite() + except discord.NotFound: + # If a guild has the vanity url feature, + # but does not have it set up, + # this prevents the command from failing + # and defaults back to another regular invite. + pass invites = await guild.invites() else: invites = []