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

How could I get all Labels? #497

Open
Narglc opened this issue Nov 21, 2023 · 6 comments
Open

How could I get all Labels? #497

Narglc opened this issue Nov 21, 2023 · 6 comments

Comments

@Narglc
Copy link

Narglc commented Nov 21, 2023

I try to use FetchAppState("regular",true,false) to get labels, but what I got are journals of labels.
So, is there any other method to get all labels?

@arugaz
Copy link
Contributor

arugaz commented Nov 21, 2023

Whatsapp has a default label, once you edit the label it will be emitted on event.LabelEdit and if you have edited before connecting to whatsmeow then it will be emitted on the first scan.

@ahmedRSA
Copy link

Whatsapp has a default label, once you edit the label it will be emitted on event.LabelEdit and if you have edited before connecting to whatsmeow then it will be emitted on the first scan.

in which event label comes ?

@ahmedRSA
Copy link

lack of comments makes it hard to call label methods
i will make a pr for that soon

@arugaz
Copy link
Contributor

arugaz commented Dec 5, 2023

you need enable these method

client.EmitAppStateEventsOnFullSync
store.DeviceProps.RequireFullSync

if you didnt enable the store.DeviceProps.RequireFullSync, you can fetch the state based on patch name
client.FetchAppState

whatsmeow/mdtest/main.go

Lines 204 to 219 in 3c97433

case "appstate":
if len(args) < 1 {
log.Errorf("Usage: appstate <types...>")
return
}
names := []appstate.WAPatchName{appstate.WAPatchName(args[0])}
if args[0] == "all" {
names = []appstate.WAPatchName{appstate.WAPatchRegular, appstate.WAPatchRegularHigh, appstate.WAPatchRegularLow, appstate.WAPatchCriticalUnblockLow, appstate.WAPatchCriticalBlock}
}
resync := len(args) > 1 && args[1] == "resync"
for _, name := range names {
err := cli.FetchAppState(name, resync, false)
if err != nil {
log.Errorf("Failed to sync app state: %v", err)
}
}

@tulir
Copy link
Owner

tulir commented Dec 5, 2023

Those two full sync options are for different things. RequireFullSync is for requesting 1 year of history instead of the default 3 months, app state full sync happens on every login regardless of the history length. Anyway, FetchAppState is the correct way to resync app state.

@lairhas
Copy link

lairhas commented May 5, 2024

Hi @tulir, let's say I've connected two different whatsmeow (different binary, different db) to one WhatsApp number. If one of the sessions has a flaw in its app state, does it affect the other?

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

No branches or pull requests

5 participants