diff options
| author | 2020-07-06 00:29:53 +0000 | |
|---|---|---|
| committer | 2020-07-06 00:29:53 +0000 | |
| commit | c4c4dfa698321912eb15ff3c1d77d1170968d124 (patch) | |
| tree | bff0d88bae8994bf3205c965f41979504ce63200 | |
| parent | Merge branch 'master' of https://git.pydis.com/bot into feat/util/1019/slowmode (diff) | |
Create a constant for the max slowmode delay
| -rw-r--r-- | bot/cogs/slowmode.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/cogs/slowmode.py b/bot/cogs/slowmode.py index ec5e9cc0d..830273174 100644 --- a/bot/cogs/slowmode.py +++ b/bot/cogs/slowmode.py @@ -13,6 +13,8 @@ from bot.utils import time log = logging.getLogger(__name__) +SLOWMODE_MAX_DELAY = 21600 # seconds + class Slowmode(Cog): """Commands for getting and setting slowmode delays of text channels.""" @@ -48,7 +50,8 @@ class Slowmode(Cog): humanized_delay = time.humanize_delta(delay) - if 0 <= slowmode_delay <= 21600: + # Ensure the delay is within discord's limits + if slowmode_delay <= SLOWMODE_MAX_DELAY: log.info(f'{ctx.author} set the slowmode delay for #{channel} to {humanized_delay}.') await channel.edit(slowmode_delay=slowmode_delay) |