Giter Site home page Giter Site logo

Get removed reactions about baileys HOT 13 OPEN

whiskeysockets avatar whiskeysockets commented on August 16, 2024
Get removed reactions

from baileys.

Comments (13)

edgardmessias avatar edgardmessias commented on August 16, 2024 8

So, let discuss about this, what we can do? Change the messages.reaction to include empty reaction (remove) or create a new event (maybe messages.reaction.delete)

👍 for update messages.reaction with empty reaction
😄 for messages.reaction.delete (or other name)

from baileys.

aidulcandra avatar aidulcandra commented on August 16, 2024 1

Well you have to manually record all the reactions and their sender id that a message has received

When receiving an empty reaction (ie. removing the reaction), then you can check what this sender's reaction emoji was.

from baileys.

andresayac avatar andresayac commented on August 16, 2024

It is documented, look at the link that I give you
https://whiskeysockets.github.io/Baileys/index.html

image

from baileys.

IanosJunior avatar IanosJunior commented on August 16, 2024

It is documented, look at the link that I give you https://whiskeysockets.github.io/Baileys/index.html

image

I would like an event to identify that the reaction has been removed.
The "messages.reaction" event does not fire when removing.

from baileys.

IanosJunior avatar IanosJunior commented on August 16, 2024

But the problem is that the "messages.reaction" event is not fired when the reaction is empty

Well you have to manually record all the reactions and their sender id that a message has received

When receiving an empty reaction (ie. removing the reaction), then you can check what this sender's reaction emoji was.

from baileys.

matheusb-comp avatar matheusb-comp commented on August 16, 2024

@IanosJunior The reason why the messages.reaction event is not fired when the reactionMessage.text is empty is probably in here, but I'm still trying to understand the code.
https://github.com/WhiskeySockets/Baileys/blob/54f8215eef2ec8911ac0fd71bdf5e2a362f98fcb/src/Utils/event-buffer.ts#LL433C27-L433C27

from baileys.

matheusb-comp avatar matheusb-comp commented on August 16, 2024

@IanosJunior Found it! The event-buffer calls the util function updateMessageWithReaction that in turn checks if the reaction text has a value before pushing the reaction to the message object:

if(reaction.text) {

Since the reactionMessage.text is empty, it will not be pushed, and (I imagine that) when the event-buffer gets flushed, the messages.reaction is not fired because this specific reaction is not in the message's "reaction list".

from baileys.

IanosJunior avatar IanosJunior commented on August 16, 2024

@IanosJunior Found it! The event-buffer calls the util function updateMessageWithReaction that in turn checks if the reaction text has a value before pushing the reaction to the message object:

if(reaction.text) {

Since the reactionMessage.text is empty, it will not be pushed, and (I imagine that) when the event-buffer gets flushed, the messages.reaction is not fired because this specific reaction is not in the message's "reaction list".

In this case, it would be better to remove this conditional to know when the reaction was removed.
What do you think @matheusb-comp ?

from baileys.

matheusb-comp avatar matheusb-comp commented on August 16, 2024

@IanosJunior Just removing this conditional would make these "reactions with empty text" to be added to the msg.reactions array.
Since the updateMessageWithReaction function is called in multiple points in the code (including the event-buffer), I don't know what problems this could cause.

What I'm doing to handle this (in my custom "data-store") is to ignore the messages.reaction event and emit custom events inside the sock.ev.on("messages.upsert", ...) based on the message.reactionMessage.text.

from baileys.

IanosJunior avatar IanosJunior commented on August 16, 2024

So, let discuss about this, what we can do? Change the messages.reaction to include empty reaction (remove) or create a new event (maybe messages.reaction.delete)

👍 for update messages.reaction with empty reaction 😄 for messages.reaction.delete (or other name)

In the tests I did, just removing the conditional already solves the problem.
I don't know if it might impact storage.

from baileys.

SalazarF92 avatar SalazarF92 commented on August 16, 2024

So, let discuss about this, what we can do? Change the messages.reaction to include empty reaction (remove) or create a new event (maybe messages.reaction.delete)

👍 for update messages.reaction with empty reaction 😄 for messages.reaction.delete (or other name)

So, will we have an update on this? I got myself stuck because of removed reactions aren't emitted.

from baileys.

PurpShell avatar PurpShell commented on August 16, 2024

Is this still an issue? Assigning myself to test this later!

from baileys.

PurpShell avatar PurpShell commented on August 16, 2024

Forgot to follow up, still an issue, will fix

from baileys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.