chore: src/ structure

This commit is contained in:
eneller
2025-11-22 00:52:12 +01:00
parent 381299cd2e
commit 8e4443852f
3 changed files with 7 additions and 4 deletions

View File

@@ -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.

2
src/log.go Normal file
View File

@@ -0,0 +1,2 @@
// https://github.com/tulir/whatsmeow/blob/071293c6b9f03f66d2e50bdd659536611d2e10f3/util/log/log.go
package main

View File

@@ -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")
}
}