#Count amount of reactions on a message
1 messages ยท Page 1 of 1 (latest)
I think this is broken, I think it should work but the "hikari.messages.Message.reactions" always comes back with 0
The reactions on the message
Top: the ID of the original message
Middle: the ID of the message with reactions on (Just to make sure I am checking the right message)
Bottom: The amount of reactions
async def message(event):
if event.author.id == 277512657957945346:
global recent_message
recent_message = event.message
print(f"Message ID: {event.message.id}")
await event.message.add_reaction(emoji="๐")
@bot.listen(hikari.ReactionAddEvent)
async def reaction(event):
if event.user_id == 654715730264064040:
return
if event.message_id != recent_message.id:
return
if event.emoji_name != "๐":
return
print(f"Recent Message ID: {recent_message.id}")
print(f"reactions length: {len(recent_message.reactions)}")```
This has to be a bug, because I use lightbulb.search.get()
and input the sequence of reactions and a attribute and it still wont work
is this disabled so the sequence always come back empty??
./tag msgcnt
Why is some information about my messages from MessageCreateEvent unavailable?
You may have not enabled the Message Content Intent. This had been a thing for bots from August 31st, 2022 onward. For more info, refer to https://support-dev.discord.com/hc/en-us/articles/4404772028055
Firstly, go to your discord developer portal. In your bot application, in the bot section, tick this to be on. (check the attached screenshot: https://i.imgur.com/8Ps9Boi.png)
Secondly, in your bot's code, add the highlighted lines:
[2;31mbot[0m [2;33m=[0m [2;36m[4;36mhikari[0m[2;36m[0m[4;2m.[0m[2;34m[4;34mGatewayBot[0m[2;34m[0m[2;33m( [2;30m# or [1;30m[4;30mlightbulb[0m[1;30m[0m[2;30m[1;30m[4;30m.[0m[1;30m[0m[2;30m[1;30m[4;30mBotApp[0m[1;30m[0m[2;30m[0m[2;33m[0m
[2;32m"your token"[0m,
[2;35m[2;40mintents[0m[2;35m[0m[2;33m[2;40m=[0m[2;33m[0m[2;36m[2;40mhikari[0m[2;36m[0m[2;40m.[0m[2;34m[2;40mIntents[0m[2;34m[0m[2;40m.[0m[2;34m[2;40mALL_UNPRIVILEGED[0m[2;34m[0m[2;40m | [0m[2;36m[2;40mhikari[0m[2;36m[0m[2;40m.[0m[2;34m[2;40mIntents[0m[2;34m[0m[2;40m.[0m[2;34m[2;40mMESSAGE_CONTENT[0m[2;34m[0m [2;30m# [1;30mAdd this line[0m[2;30m[0m
[2;33m)[0m
You should now receive all information about such messages. :)
Note: You will still receive this information for messages in which the bot is pinged and for any message in DMs, regardless of the intent.
@compact mauve read that ^
I tried doing all of that but it still comes back empty
I even gave it admin and more intent just incase
bot = lightbulb.BotApp(token="TOKEN", intents=hikari.Intents.ALL_UNPRIVILEGED | hikari.Intents.MESSAGE_CONTENT | hikari.Intents.DM_MESSAGES | hikari.Intents.GUILD_MESSAGES)
also done all the intents you said and the ones in the MessageCreateEvent
is it because its the creation of the message and it wont get updated so the reactions are always empty??
I tried the hikari.Intents.ALL and still don't work
I just tried "bot.cache.get_message(recent_message).reactions" and still wont work.
It isnt that the cache is old or anything like that because if i edit the message then fire the event it gets the new edited version
it just cant see the reactions
Also just switched it to hikari.GatewayBot() and still no work
I re-invited it after every change as well incase that would fix anything
Yh i am lost on this, seems like it should work but wont.
lemme get a bot running to test this myself
@compact mauve
hikari should have warned you when starting your bot
if you have silenced warnings, I would recommend not
The event gets fired
but I cant get the reactions from the "Message"
The even got fired even when I didn't use the intents
Also i haven't got any warning, my IDE might be configured wrong not sure
yh but not the intent warnings, or do I have to enable the optimizations for the intent ones??
nvm i enabled optimizations and still no warnings about intent
I've tried everything that seems logical to me, i feel like this should work especially with the intents but it dont, I could just be completely wrong.