Fix usage and help message for sync command

This commit is contained in:
Tulir Asokan 2022-09-18 14:46:16 +03:00
parent 20e6d9e659
commit a112e48467

View file

@ -1063,21 +1063,21 @@ var cmdSync = &commands.FullHandler{
Help: commands.HelpMeta{
Section: HelpSectionMiscellaneous,
Description: "Synchronize data from WhatsApp.",
Args: "<appstate/contacts/groups/space> [--create-portals]",
Args: "<appstate/contacts/groups/space> [--contact-avatars] [--create-portals]",
},
RequiresLogin: true,
}
func fnSync(ce *WrappedCommandEvent) {
if len(ce.Args) == 0 {
ce.Reply("**Usage:** `sync <appstate/contacts/avatars/groups/space> [--contact-avatars] [--create-portals]`")
return
}
args := strings.ToLower(strings.Join(ce.Args, " "))
contacts := strings.Contains(args, "contacts")
appState := strings.Contains(args, "appstate")
space := strings.Contains(args, "space")
groups := strings.Contains(args, "groups") || space
if !contacts && !appState && !space && !groups {
ce.Reply("**Usage:** `sync <appstate/contacts/groups/space> [--contact-avatars] [--create-portals]`")
return
}
createPortals := strings.Contains(args, "--create-portals")
contactAvatars := strings.Contains(args, "--contact-avatars")
if contactAvatars && (!contacts || appState) {