From 758edf044bfc24aeb8e00c8e244a770c6a247d42 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Thu, 4 Jun 2020 23:14:51 -0700 Subject: Fix AttributeError for category check Not all channels will have a category attribute. This may be fine in production, but it does cause periodic errors when testing locally. --- bot/cogs/stats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/cogs/stats.py b/bot/cogs/stats.py index 4ebb6423c..d42f55466 100644 --- a/bot/cogs/stats.py +++ b/bot/cogs/stats.py @@ -36,7 +36,8 @@ class Stats(Cog): if message.guild.id != Guild.id: return - if message.channel.category.id == Categories.modmail: + cat = getattr(message.channel, "category", None) + if cat is not None and cat.id == Categories.modmail: if message.channel.id != Channels.incidents: # Do not report modmail channels to stats, there are too many # of them for interesting statistics to be drawn out of this. -- cgit v1.2.3