aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Den4200 <[email protected]>2020-07-03 15:53:31 +0000
committerGravatar Den4200 <[email protected]>2020-07-03 15:53:31 +0000
commit5cfad8c592388bfff4152a684e10f7d8a04e6426 (patch)
treee87ada8ba44a5b7dd91e64c4c625b78d81bda6bb
parentRemove precision kwarg usage (diff)
Move log to before what it's logging executes.
This makes sure the log will be made, since the operations executed are now below it.
-rw-r--r--bot/cogs/slowmode.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/bot/cogs/slowmode.py b/bot/cogs/slowmode.py
index 9f69d30e0..593208bea 100644
--- a/bot/cogs/slowmode.py
+++ b/bot/cogs/slowmode.py
@@ -50,31 +50,33 @@ class Slowmode(Cog):
humanized_delay = time.humanize_delta(delay)
if 0 <= slowmode_delay <= 21600:
+ log.info(f'{ctx.author} set the slowmode delay for #{channel} to {humanized_delay}.')
+
await channel.edit(slowmode_delay=slowmode_delay)
await ctx.send(
f'{Emojis.check_mark} The slowmode delay for {channel.mention} is now {humanized_delay}.'
)
- log.info(f'{ctx.author} set the slowmode delay for #{channel} to {humanized_delay}.')
-
else:
- await ctx.send(
- f'{Emojis.cross_mark} The slowmode delay must be between 0 and 6 hours.'
- )
log.info(
f'{ctx.author} tried to set the slowmode delay of #{channel} to {humanized_delay}, '
'which is not between 0 and 6 hours.'
)
+ await ctx.send(
+ f'{Emojis.cross_mark} The slowmode delay must be between 0 and 6 hours.'
+ )
+
@slowmode_group.command(name='reset', aliases=['r'])
@with_role(*MODERATION_ROLES)
async def reset_slowmode(self, ctx: Context, channel: TextChannel) -> None:
"""Reset the slowmode delay for a given text channel to 0 seconds."""
+ log.info(f'{ctx.author} reset the slowmode delay for #{channel} to 0 seconds.')
+
await channel.edit(slowmode_delay=0)
await ctx.send(
f'{Emojis.check_mark} The slowmode delay for {channel.mention} has been reset to 0 seconds.'
)
- log.info(f'{ctx.author} reset the slowmode delay for #{channel} to 0 seconds.')
def setup(bot: Bot) -> None: