本文介紹了Discord.py 如何發(fā)出靜音命令?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
正如標(biāo)題所說.我試圖弄清楚如何使用 discord.py 重寫來制作靜音命令.我認(rèn)為我們需要一個靜音"角色,其中使用的命令為用戶提供靜音"角色以及持續(xù)多長時間.我如何做到這一點.
As the title says. I'm trying to figure out how to make a mute command using discord.py rewrite. I'm thinking that we need to have a "mute" role where the command used gives the user the "mute" role and for how long. How do I achieve this.
我已經(jīng)有了
@bot.command()
@commands.has_permissions(mute_members)
async def mute(ctx, member:discord.Member):
推薦答案
您可以創(chuàng)建一個靜音角色,并讓您的機器人將角色添加到您要靜音的用戶:
you can create a Muted role and make your bot add the role to the user you want to mute:
@bot.command()
async def mute(ctx, member: discord.Member):
role = discord.utils.get(ctx.guild.roles, name='Muted')
await member.add_roles(role)
await ctx.send("role added")
這篇關(guān)于Discord.py 如何發(fā)出靜音命令?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!