[英]How to make a command to change channel cooldown discord.py
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
.您可以使用
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}!")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.