I want to make a command that can make some user deafen and muted, and I can say $deafen @here
or $deafen @everyone
and make corresponding person deafen and muted.
@bot.command()
async def deafen(ctx, member: discord.Member):
await member.edit(deafen=True)
According to the Discord documentation, discord.Member
has a edit
function that allows you to pass a boolean for deafen to change it
As a simple proof of concept, the following should theoretically deafen the person:
@bot.command()
async def deafen(ctx, usr : discord.Member):
await usr.edit(deafen=True)
Of course, you'll have to work the command into your own code
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.