#Count amount of reactions on a message

1 messages ยท Page 1 of 1 (latest)

compact mauve
#

"hikari.messages.Message.reactions" returns the class "hikari.messages.Reaction" which is where the data is or where i think it is

compact mauve
#

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)}")```
compact mauve
#

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??

fallow jasper
#

./tag msgcnt

rocky cometBOT
#

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:

bot = hikari.GatewayBot( # or lightbulb.BotApp
    "your token",
    intents=hikari.Intents.ALL_UNPRIVILEGED | hikari.Intents.MESSAGE_CONTENT # Add this line
)

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.

fallow jasper
#

@compact mauve read that ^

compact mauve
#

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.

fallow jasper
#

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

compact mauve
#

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

compact mauve
fallow jasper
#

the warnings are being shown

#

that yellow line in your console is also a warning

compact mauve
#

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

compact mauve
fallow jasper
#

yeah idk tbh

#

could be because you're using a global variable

#

but if you also got it from the cache I'm not sure