Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: listener for labels association events created #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MateoMax-hub
Copy link

@MateoMax-hub MateoMax-hub commented Jul 24, 2023

FEATURE:
event for labels.association are now assigned to a a new listener "ON_LABEL_ASSOCIATION" and used on the function "onLabelAssociation", the function will receive a callback to execute each time the events get triggered (adding o removing a label on a chat), in the parameters of the callback you will receive an obj like this:

{
  'labels.association': {
    type: 'add',
    association: {
      type: 'label_jid',
      chatId: '(number-of-the-chat-here)@s.whatsapp.net',
      labelId: '3'
    }
  }
}

type can be add or remove depending if you are adding or removing a label, and labelId is an id for the label selected to do this event, i'm planning on making a function to get the labels an maybe i can at that point integrate it with this so you can get the labelId and it's name too

@MateoMax-hub
Copy link
Author

this works for me, @mimamch if you need me to make any changes on this pr, request them freely i will look into it, and if you don't want this change on your project it's fine too i can use it from my forked repository.
I'm also planning on a function to get the labels created

@MateoMax-hub MateoMax-hub changed the title listener for labels association events created [FEATURE]: listener for labels association events created Jul 24, 2023
@MateoMax-hub
Copy link
Author

i added a listener for labels.edit too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant