Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a bot set the slowmode for a channel in discord.py rewrite?

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?

like image 599
Ultimus Avatar asked Jun 07 '20 11:06

Ultimus


People also ask

How do you make a custom Slowmode on discord?

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.

How do you use Slowmode bot?

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 .


1 Answers

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:

  • f-Strings
  • Context.channel
  • TextChannel.edit() - setting the delay to 0 will disable slowmode.
like image 111
Diggy. Avatar answered Oct 04 '22 03:10

Diggy.