aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2024-03-18 00:08:36 +0200
committerGravatar mbaruh <[email protected]>2024-03-18 00:08:36 +0200
commitc99857125f51b80bcc61b5a3030b1fdec1d79bb8 (patch)
treebd7f7540bbcd4968bec9faf5bfa44a4bab4fa1e3
parentMerge branch 'main' into phishing_button (diff)
Handle errors when adding invite
-rw-r--r--bot/exts/filtering/_ui/ui.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/exts/filtering/_ui/ui.py b/bot/exts/filtering/_ui/ui.py
index 711006222..d5b70e944 100644
--- a/bot/exts/filtering/_ui/ui.py
+++ b/bot/exts/filtering/_ui/ui.py
@@ -9,7 +9,7 @@ from typing import Any, TypeVar, get_origin
import discord
from discord import Embed, Interaction, Member, User
-from discord.ext.commands import Context, Converter
+from discord.ext.commands import BadArgument, Context, Converter
from discord.ui.select import MISSING as SELECT_MISSING, SelectOption
from discord.utils import escape_markdown
from pydis_core.site_api import ResponseCodeError
@@ -567,7 +567,10 @@ class PhishConfirmationView(discord.ui.View):
await interaction.followup.send(message)
else:
ctx = FakeContext(interaction.message, interaction.channel, compf_command)
- await compf_command(ctx, self.target_filter_list.name, self.phishing_content)
+ try:
+ await compf_command(ctx, self.target_filter_list.name, self.phishing_content)
+ except BadArgument as e:
+ await interaction.followup.send(f":x: Could not add the filter: {e}")
@discord.ui.button(label="Cancel")