I just wanted to ask how can i make a command, that will change channel sending messages cooldown. That's all.
You can use slowmode_delay
.
No cogs:
@client.command()
@commands.has_permissions(manage_messages=True) # Permission to use command
async def slowmode(self, ctx, seconds: int): # seconds
await ctx.channel.edit(slowmode_delay=seconds) # Edits the channel, (slowmode_delay = channel slowmode.
await ctx.send(f"I've set the slowmode to **{seconds}** seconds in {ctx.channel.mention}!") # Message sent after the slowmode is set.
Cogs:
@commands.command()
@commands.has_permissions(manage_messages=True)
async def slowmode(self, ctx, seconds: int):
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.send(f"I've set the slowmode to **{seconds}** seconds in {ctx.channel.mention}!")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.