aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-10-02 20:19:49 +0100
committerGravatar Chris Lovering <[email protected]>2022-10-02 20:20:04 +0100
commit2142d824272c738c3d4ac9f20dd59cc4f02e345e (patch)
tree48bc7987b518c4336519204171cb5855652ce231
parentSend weekly_autoban_report to ctx channel when manually invoked (diff)
Make autoban report silently fail if output will be sent to a non-mod channel
-rw-r--r--bot/exts/filters/filter_lists.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/exts/filters/filter_lists.py b/bot/exts/filters/filter_lists.py
index edc2d09f3..c429b0eb9 100644
--- a/bot/exts/filters/filter_lists.py
+++ b/bot/exts/filters/filter_lists.py
@@ -15,6 +15,7 @@ from bot.constants import Channels, Colours
from bot.converters import ValidDiscordServerInvite, ValidFilterListType
from bot.log import get_logger
from bot.pagination import LinePaginator
+from bot.utils.channel import is_mod_channel
log = get_logger(__name__)
WEEKLY_REPORT_ISO_DAY = 3 # 1=Monday, 7=Sunday
@@ -315,6 +316,9 @@ class FilterLists(Cog):
seven_days_ago = arrow.utcnow().shift(days=-7)
if not channel:
channel = self.bot.get_channel(Channels.mod_meta)
+ elif not is_mod_channel(channel):
+ # Silently fail if output is going to be a non-mod channel.
+ return
added_autobans = defaultdict(list)
# Extract all autoban filters added in the past 7 days from each filter type