【发布时间】:2018-07-27 16:01:06
【问题描述】:
所以我一直试图让这个命令 $100ivShiny 给我的成员实际排名 100ivShiny。但我似乎找不到解决方案。
if message.content.startswith('$100ivShiny'):
role = discord.utils.get(message.server.roles, name="100ivShiny")
await client.add_role(user, role)
await client.send_message(channel, "Role added")
这是我遇到的错误
File "mod.py", line 29, in on_message
await client.add_role(user, role)
AttributeError: '<class 'discord.client.Client'>' object has no attribute 'add_role'
【问题讨论】:
-
这个错误会告诉你到底出了什么问题。
client没有add_role方法。阅读 Discord 的 API 以了解调用的方法。
标签: python discord discord.py