How do you make a bot set the slow mode for a channel in discord.py
rewrite?
I tried doing this: ctx.channel.slowmode_delay = 10
It didn't get any error, but when I called the above command the slowmode was not applied.
What else can I do?
To get this set up, navigate to your Channel Settings by clicking on the cog icon to Edit Channel > Overview. You'll see the Slowmode option along with a slider where you can adjust the time intervals.
Click the Settings button underneath the Slowmode module. For the Channel option, select the channel you want to apply slowmode to. For the Select rate limit (seconds) option, type the slowmode rate. Select Channel Slowmode or User Slowmode , and then select Add .
Here's an example command:
@bot.command()
async def setdelay(ctx, seconds: int):
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.send(f"Set the slowmode delay in this channel to {seconds} seconds!")
References:
Context.channel
TextChannel.edit()
- setting the delay to 0 will disable slowmode.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With