diff options
| author | 2020-07-06 01:41:21 +0000 | |
|---|---|---|
| committer | 2020-07-06 01:41:21 +0000 | |
| commit | b04c4163f97bb3c811096587ed1db51d9754114b (patch) | |
| tree | 6ac874f57c37d85eba0130060487f225397d5fee | |
| parent | Merge branch 'feat/util/1019/slowmode' of https://git.pydis.com/bot into feat... (diff) | |
Default to the channel that `slowmode set` was invoked in
| -rw-r--r-- | bot/cogs/slowmode.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/cogs/slowmode.py b/bot/cogs/slowmode.py index 0b9b64976..93ddf4b19 100644 --- a/bot/cogs/slowmode.py +++ b/bot/cogs/slowmode.py @@ -41,8 +41,12 @@ class Slowmode(Cog): await ctx.send(f'The slowmode delay for {channel.mention} is {humanized_delay}.') @slowmode_group.command(name='set', aliases=['s']) - async def set_slowmode(self, ctx: Context, channel: TextChannel, delay: DurationDelta) -> None: + async def set_slowmode(self, ctx: Context, channel: Optional[TextChannel], delay: DurationDelta) -> None: """Set the slowmode delay for a given text channel.""" + # Use the channel this command was invoked in if one was not given + if not channel: + channel = ctx.channel + # Convert `dateutil.relativedelta.relativedelta` to `datetime.timedelta` # Must do this to get the delta in a particular unit of time utcnow = datetime.utcnow() |