简体   繁体   English

尝试使用命令删除角色

[英]Trying to remove a role with a command

I am trying to make a command that removes the role when they call the command.我正在尝试创建一个命令,当他们调用命令时删除角色。 I am making it when the use of this command takes the unverified role away.当使用此命令取消未经验证的角色时,我正在制作它。 I'm not getting any errors it just won't remove it at all.我没有收到任何错误,它根本不会删除它。 I've tried so many solutions but I just can not seem to get it.我已经尝试了很多解决方案,但我似乎无法得到它。

The role names match up, and the spelling is all correct角色名称匹配,拼写全部正确

CODE:代码:

@bot.command()
@commands.has_role('Unverfied')
async def verify(ctx , member : discord.Member):
        guild = ctx.guild
        verf = discord.utils.get(guild.roles, name="Unverfied")
        await ctx.remove_roles(verf)

我想出了我的问题,我需要在代码中调用作者部分。

await ctx.author.remove_roles(verf)

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

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