2
2
20two.may2020-11-05 22:08:56
Python
20two.may, 2020-11-05 22:08:56

The on_raw_reaction_add() function does not work. What is the problem?

Hello. In general, I decided to break my bot into several separate scripts / files. And this error appeared when executing the function, which will be given below:

[<Member id=726559007019630593 name='CISBOT' discriminator='0598' bot=True nick=None guild=<Guild id=540944004041146399 name='CISCORD' shard_id=None chunked=False member_count=63>>]
AttributeError("'NoneType' object has no attribute 'id'")
AttributeError("'NoneType' object has no attribute 'remove_roles'")


It is in this piece of code that the error appears. As I understand it, the error is specifically when searching for a member , because when you try to display all the participants using print(message.guild.members), that is the same error.
Function:
@client.event
async def on_raw_reaction_add(payload):
  if str(payload.message_id) == str(shop_embs.EMB1_ID) or str(payload.message_id) == str(shop_embs.EMB2_ID) or str(payload.message_id) == str(shop_embs.EMB3_ID):
    channel = client.get_channel(payload.channel_id)
    message = await channel.fetch_message(payload.message_id)
    print(message.guild.members)
    member = utils.get(message.guild.members, id=payload.user_id)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
101-s, 2020-11-06
@101-s

I decided to split my bot into several separate scripts / files,
if before that everything worked fine, then there could be a problem with connecting modules? or the problem is that the script does not see the variables. Are you programming in an IDE?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question