I'm creating a discord reaction bot which assigns members roles depending on which reaction emoji they use.
I've found discord.utils.find works as expected when running the app locally, but doesn't find a member when the app is hosted on Heroku or ibmcloud.
@client.event
async def on_raw_reaction_remove(payload):
message_id = payload.message_id
#...
#...
#...
# payload.member is not available for REACTION_REMOVE event type
member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
member2id = int(payload.user_id)
GetMember = discord.Guild.get_member()
RoleLoser = GetMember(member2id)
To get around this I'm trying to search the member list for a given guild and return a member using their member id. But running the above prompts the following with reference to this line GetMember = discord.Guild.get_member()
No value for argument 'self' in unbound method call
No value for argument 'user_id' in unbound method call
Really appreciate any help!
on_rawevent, you're only able to access the id for some objects eg. Guild, in your case you should be first getting the guild by ID and then passing it tofind. Soguild = client.get_guild(payload.guild_id)(assuming client is commands.Bot(). Thus you should calling.get_memberon theguildobject you fetched by theirid. - InsertCheesyLine