aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-30 09:41:00 -0700
committerGravatar MarkKoz <[email protected]>2020-03-30 09:46:08 -0700
commitd37a0a16e391ad14f2569a245ee205223f8f26dc (patch)
tree88735174da40515c98fcdedbc8c8434720ed5830
parentHelpChannels: use constant names instead of default values in docstring (diff)
ModLog: ignore update channel events for help channels
The edit causes two channel update events to dispatch simultaneously: one for the channel topic changing and one for the category changing. The ModLog cog currently doesn't support ignoring multiple events of the same type for the same channel. Therefore, the ignore was hard coded rather than using the typical ignore mechanism. This is intended to be a temporary solution; it should be removed once the ModLog is changed to support this situation.
-rw-r--r--bot/cogs/moderation/modlog.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py
index c63b4bab9..beef7a8ef 100644
--- a/bot/cogs/moderation/modlog.py
+++ b/bot/cogs/moderation/modlog.py
@@ -15,7 +15,7 @@ from discord.ext.commands import Cog, Context
from discord.utils import escape_markdown
from bot.bot import Bot
-from bot.constants import Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, URLs
+from bot.constants import Categories, Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, URLs
from bot.utils.time import humanize_delta
log = logging.getLogger(__name__)
@@ -188,6 +188,12 @@ class ModLog(Cog, name="ModLog"):
self._ignored[Event.guild_channel_update].remove(before.id)
return
+ # Two channel updates are sent for a single edit: 1 for topic and 1 for category change.
+ # TODO: remove once support is added for ignoring multiple occurrences for the same channel.
+ help_categories = (Categories.help_available, Categories.help_dormant, Categories.help_in_use)
+ if after.category and after.category.id in help_categories:
+ return
+
diff = DeepDiff(before, after)
changes = []
done = []