简体   繁体   English

python discord 聋指令

[英]python discord deafen command

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.我想做一个命令,可以使某些用户耳聋和静音,我可以说$deafen @here$deafen @everyone并使相应的人耳聋和静音。

@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根据Z8F5CC6430613F1C12F369650BB7197Z文档, discord.Member具有edit ZC1C425268EPBAR iTABR flaster ZC425268EED511174C1174C174FABER IFY174FE174FE174FABANENFER iTAB174FABANENFERE

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当然,您必须命令放入您自己的代码中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM