commit b2736d7053624c30fe59bc6ad6ee7327f199fa06
parent 161480afd5918323ffe7e26bd059631b8e9523f8
Author: decentral1se <cellarspoon@riseup.net>
Date: Sun, 1 Dec 2024 20:35:51 +0100
fix: if sendMUCMessage fails, let's see it
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/warawara.go b/warawara.go
@@ -54,7 +54,7 @@ type textMessage struct {
Body string `xml:"body"`
}
-func sendMUCMessage(text string) {
+func sendMUCMessage(text string) error {
to := jid.MustParse(MUCJID)
var msg textMessage = textMessage{
Message: stanza.Message{
@@ -62,7 +62,7 @@ func sendMUCMessage(text string) {
To: to,
Type: "groupchat"},
Body: text}
- session.Encode(ctx, msg)
+ return session.Encode(ctx, msg)
}
func joinXMPP() {
@@ -129,7 +129,9 @@ func fetchFeed() {
if pDate != pDateOld {
breakingNews := "🗨️ " + pTitle + " " + pDescription + "\n" + pLink
fmt.Println(breakingNews)
- sendMUCMessage(breakingNews)
+ if err := sendMUCMessage(breakingNews); err != nil {
+ fmt.Println("Error: ", err)
+ }
pDateOld = pDate
}
}