Skip to content

Commit

Permalink
Example starring message
Browse files Browse the repository at this point in the history
  • Loading branch information
arugaz committed Dec 9, 2023
1 parent 744d19e commit 9fa5f6f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions mdtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,37 @@ func handleCmd(cmd string, args []string) {
if err != nil {
log.Errorf("Error changing chat's pin state: %v", err)
}
case "star":
if len(args) < 5 {
log.Errorf("Usage: star <target> <sender> <messageID> <fromMe> <action>")
return
}
target, ok := parseJID(args[0])
if !ok {
return
}
sender, ok := parseJID(args[1])
if !ok {
return
}
messageID := args[2]
fromMe, err := strconv.ParseBool(args[3])
if err != nil {
log.Errorf("invalid fourth argument: %v", err)
return
}
action, err := strconv.ParseBool(args[4])
if err != nil {
log.Errorf("invalid fifth argument: %v", err)
return
}
err = cli.SendAppState(appstate.BuildStar(target, sender, messageID, fromMe, action))
if err != nil {
log.Errorf("Error changing message's star state: %v", err)
return
} else {
log.Infof("Star state updated")
}
case "getblocklist":
blocklist, err := cli.GetBlocklist()
if err != nil {
Expand Down

0 comments on commit 9fa5f6f

Please sign in to comment.