whatsmeow
whatsmeow copied to clipboard
Implement writing app state
If we write one of these functions, we write the rest. App state write so important.
I'm offering you $500. I really need appstates.
Ping, ping...
I beg you, can we at least do chat pinning? Only Pin, only..
https://github.com/tulir/whatsmeow/commit/a168fde5a9dee4d950ca1dd26b5093a80eea2399
Really? 👯♀️ I'm so excited..
@tulir Baileys already implement app state, Do you have any plan to add it?
I already started working on it myself but there's few things i don't understand. For example how do i get App State Sync Key? Here's the mute function i'm working on
func (cli *Client) Mute(jid types.JID) error {
version, hash, err := cli.Store.AppState.GetAppStateVersion("regular_high")
if err != nil {
return fmt.Errorf("failed to get app state %s version: %w", "regular_high", err)
}
state := appstate.HashState{Version: version, Hash: hash}
type Patch struct {
SyncAction SyncAction `json:"syncAction"`
Index []string `json:"index"`
Type string `json:"type"`
APIVersion int64 `json:"apiVersion"`
Operation int64 `json:"operation"`
}
type SyncAction struct {
MuteAction MuteAction `json:"muteAction"`
Timestamp int64 `json:"timestamp"`
}
type MuteAction struct {
Muted bool `json:"muted"`
MuteEndTimestamp int64 `json:"muteEndTimestamp"`
}
index := []string{"mute", jid.String()}
patch := Patch{
SyncAction: SyncAction{
MuteAction: MuteAction{
Muted: true,
},
Timestamp: int64(time.Now().UnixNano()),
},
Type: "regular_high",
APIVersion: state.Version,
Operation: 0,
}
patchbytes, _ := json.Marshal(patch)
mu := cli.Store.AppState.EncodeMutations()/// Missing func
statusNode, err := cli.sendIQ(infoQuery{
Namespace: "w:sync:app:state",
Type: "set",
To: types.ServerJID,
ID: cli.generateRequestID(),
Content: []waBinary.Node{{
Tag: "sync",
Content: []waBinary.Node{{
Tag: "collection",
Attrs: waBinary.Attrs{
"name": "regular_high",
"version": state.Version,
"return_snapshot": "false",
},
Content: []waBinary.Node{{
Tag: "patch",
Content: mu,
}},
}},
}},
})
log.Printf("Mute:-\n%v\nerr:- %v", Typetojson(statusNode), err)
if err != nil {
return err
}
_, ok := statusNode.GetOptionalChildByTag("error")
if ok {
return parseIQError(statusNode)
}
return nil
}
Any update on this?
@tulir Any update? Only pin..
@tulir Any update? Only pin..
what will you do with chat pin?
Let's do chat pin in honor of the 1st year @tulir
At least show me the way. Let's do it ourselves. We need it more than ever. Not just for me. Thousands of developer are waiting for this writing to app state.
Please...
To do what it takes? Time? Money? Let's raise funds your between us.
We love you and we are so grateful @tulir. If you won't tell us, let's not wait or develop programs in this library any more.
Thanks
- One of the dozens of developer who love you
I'm offering you $500. I really need appstates.
@1337-sys If it's a real bounty, I suggest you join the repo's official Matrix room and offer it up there.
@Ased2235 I suggest you do the same. The WhatsMeow community's more vocal on the Matrix than on Github.
@Paguiar735 Those in this group already know the criticality of the situation. I tried to github sponsor a lot, but Github does not accept any card. I want a swift code from him. This is not a bribe. I give this not in exchange for a feature, but of all sincerity.
I wish I could see such a commit when I wake up morning.
https://github.com/Auties00/WhatsappWeb4j/commit/5a4a8ae389cff88921fd00c3f901eba16c121a1b (App state writes now work!)
dude stop spamming if you really need state that bad why not just use other libs ??
You even have the other libs to look at. If Tulir won't do it, you can work on it on your own and do a pull request 😅