discord.py 2.0 update (3d914e08->2.0.1) (#5709)

This commit is contained in:
Jakub Kuczys
2022-10-03 16:07:15 +02:00
committed by GitHub
parent d7d6ab46f4
commit f02528378f
44 changed files with 454 additions and 317 deletions

View File

@@ -1,3 +1,4 @@
import discord
import re
from .abc import MixinMeta
from datetime import timedelta
@@ -24,11 +25,14 @@ class Slowmode(MixinMeta):
minimum=timedelta(seconds=0), maximum=timedelta(hours=6), default_unit="seconds"
) = timedelta(seconds=0),
):
"""Changes thread's or channel's slowmode setting.
"""Changes thread's or text channel's slowmode setting.
Interval can be anything from 0 seconds to 6 hours.
Use without parameters to disable.
"""
if not isinstance(ctx.channel, (discord.TextChannel, discord.Thread)):
await ctx.send(_("Slowmode can only be set in text channels and threads."))
return
seconds = interval.total_seconds()
await ctx.channel.edit(slowmode_delay=seconds)
if seconds > 0: