diff options
| author | 2020-06-04 23:14:51 -0700 | |
|---|---|---|
| committer | 2020-06-04 23:14:51 -0700 | |
| commit | 758edf044bfc24aeb8e00c8e244a770c6a247d42 (patch) | |
| tree | a6e3e6e030a6dffc2407529fe1e511739b720368 | |
| parent | Merge pull request #979 from neonsea/modmail-tag (diff) | |
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.
| -rw-r--r-- | bot/cogs/stats.py | 3 |
1 files changed, 2 insertions, 1 deletions
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. |