我想组建一个能够发布和扮演角色的团队。但它给出了这个错误:
CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'guild'
编码:
@bot.command()
async def leave(ctx):
user = ctx.author.id
ctx.channel.purge(limit=1)
role = ds.utils.get(user.guild.roles, name='Ожидание')
role2 = ds.utils.get(user.guild.roles, name='Вне игры')
user.add_roles(role2)
user.remove_roles(role)
config.players = config.players - 1
谁能告诉我错在哪里?
ctx.author.id
是数字https://discordpy.readthedocs.io/en/stable/api.html?highlight=member#discord.Member