【发布时间】:2020-10-14 23:37:33
【问题描述】:
我遇到了这个问题,但我仍然找不到解决方案,这是代码
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload):
if payload.message_id == commands.reaction_message.id and commands.reaction_role != None:
await payload.member.add_roles(commands.reaction_role)
@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload):
if payload.message_id == commands.reaction_message.id and commands.reaction_role != None:
guild = self.client.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
await member.remove_roles(commands.reaction_role)
@commands.command()
async def set_reaction_message(self, ctx, message_id=None, role_id=None):
for channel in ctx.guild.channels:
try:
commands.reaction_message = await channel.fetch_message(int(message_id))
break
except:
pass
问题:文件“c:\Users\MY-NAME\Desktop\Overige en school\Discord Bot\cogs\reaction.py”,第 17 行,on_raw_reaction_add 等待 payload.member.add_roles(commands.reaction_role) AttributeError:“RawReactionActionEvent”对象没有属性“成员”
谁能帮帮我,这已经困扰我 2 天了,我什至找不到解决方案
【问题讨论】:
标签: discord discord.py discord.py-rewrite