Skip to content

Commit

Permalink
Added slowmode tracking to dpy and ot0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaruh committed Jan 21, 2021
1 parent 1d83eff commit 5c45e7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions bot/constants.py
Expand Up @@ -408,6 +408,7 @@ class Channels(metaclass=YAMLGetter):
code_help_voice_2: int
cooldown: int
defcon: int
discord_py: int
dev_contrib: int
dev_core: int
dev_log: int
Expand Down
10 changes: 8 additions & 2 deletions bot/exts/moderation/slowmode.py
Expand Up @@ -15,6 +15,12 @@

SLOWMODE_MAX_DELAY = 21600 # seconds

COMMONLY_SLOWMODED_CHANNELS = {
Channels.python_general: "python_general",
Channels.discord_py: "discordpy",
Channels.off_topic_0: "ot0",
}


class Slowmode(Cog):
"""Commands for getting and setting slowmode delays of text channels."""
Expand Down Expand Up @@ -58,9 +64,9 @@ async def set_slowmode(self, ctx: Context, channel: Optional[TextChannel], delay
log.info(f'{ctx.author} set the slowmode delay for #{channel} to {humanized_delay}.')

await channel.edit(slowmode_delay=slowmode_delay)
if channel.id == Channels.python_general:
if channel.id in COMMONLY_SLOWMODED_CHANNELS:
log.info(f'Recording slowmode change in stats for {channel.name}.')
self.bot.stats.gauge(f"slowmode.{channel.name}", slowmode_delay)
self.bot.stats.gauge(f"slowmode.{COMMONLY_SLOWMODED_CHANNELS[channel.id]}", slowmode_delay)

await ctx.send(
f'{Emojis.check_mark} The slowmode delay for {channel.mention} is now {humanized_delay}.'
Expand Down
3 changes: 3 additions & 0 deletions config-default.yml
Expand Up @@ -162,6 +162,9 @@ guild:
# Python Help: Available
cooldown: 720603994149486673

# Topical
discord_py: 343944376055103488

# Logs
attachment_log: &ATTACH_LOG 649243850006855680
message_log: &MESSAGE_LOG 467752170159079424
Expand Down

0 comments on commit 5c45e7f

Please sign in to comment.