Quellcode durchsuchen

Fix usage and help message for sync command

Tulir Asokan vor 2 Jahren
Ursprung
Commit
a112e48467
1 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
  1. 5 5
      commands.go

+ 5 - 5
commands.go

@@ -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) {