diff --git a/README.md b/README.md index 8cba912..ef85c46 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ CLI Whatsapp Messages (and Polls) using go: - [urfave/cli](https://github.com/urfave/cli) for the command line # Usage -Can be easily scheduled using `crontab` because of its non-interactive operation +Can be easily scheduled using `crontab` because of its non-interactive operation. +Avoid quick consecutive logins by using the stdin option to send multiple messages in one session. ``` NAME: schneller-whatsapp - Run WhatsApp actions from your CLI. User JID has to end with '@s.whatsapp.net', Group ID with '@g.us'. Defaults to listening on stdin for batch processing. diff --git a/src/log.go b/src/log.go new file mode 100644 index 0000000..3d5d89c --- /dev/null +++ b/src/log.go @@ -0,0 +1,2 @@ +// https://github.com/tulir/whatsmeow/blob/071293c6b9f03f66d2e50bdd659536611d2e10f3/util/log/log.go +package main diff --git a/main.go b/src/main.go similarity index 99% rename from main.go rename to src/main.go index 60b30f9..ba2602d 100644 --- a/main.go +++ b/src/main.go @@ -80,10 +80,10 @@ func sendMessage(message *waE2E.Message, jidStr string, client *whatsmeow.Client } _, err = client.SendMessage(context.Background(), JID, message) // FIXME showing error even when successful - if err == nil { - slog.Info("Sent Message successfully") - } else { + if err != nil { slog.Error("Failed to send message", "error", err) + } else { + slog.Info("Sent Message successfully") } }