【发布时间】:2021-03-17 10:14:40
【问题描述】:
所以我正在尝试执行 AFK 命令,但昵称不起作用。这是我的代码。
@Client.command(name="AFK")
async def afk(context):
name = context.author.display_name
author = context.author
guild = context.guild
AFKrole = discord.utils.get(guild.roles, name="AFK")
if not AFKrole:
AFKrole = await guild.create_role(name="AFK")
await context.member.edit(nick=f"[AFK]{name}")
await author.add_roles(AFKrole)
await context.send(f"I have added {author} to AFK.")
【问题讨论】:
-
嗯,这是因为bot无权更改公会所有者的昵称。您必须创建备用帐户并在其上尝试此命令。
标签: python-3.x discord.py