反应角色 Discord.py python

时间:2021-07-31 18:42:40

标签: discord discord.py

discord.py 反应作用不起作用我添加了意图 而且还是不行

@client.command()
async def reactrole(ctx, emoji, role: discord.Role, *, message):
    embedVar = discord.Embed(description=message)
    msg = await ctx.channel.send(embed=embedVar)
    await msg.add_reaction(emoji)
  
    with open('reactrole.json') as json_file:
        data = json.load(json_file)

    new_react_role = {
        'role_name': role.name,
        'role_id': role.id,
        'emoji': emoji,
        'message_id': msg.id
    }

    data.append(new_react_role)

    with open('reactrole.json', 'w') as j:
      json.dump(data, j, indent=4)

0 个答案:

没有答案