commit f360f101423d5285b8fb3382664ab91c7b746473
parent cf5f8180dd0e994413af2a35ec2288a1d23efb20
Author: decentral1se <cellarspoon@riseup.net>
Date: Sun, 1 Dec 2024 21:00:22 +0100
fix: skip alert on first run
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/warawara.go b/warawara.go
@@ -113,6 +113,7 @@ func joinMUC() {
func fetchFeed() {
pDateOld := ""
+ isFirstRun := true
for {
fmt.Println("trying to fetch feed")
if feed, err := http.Get(feedURL); err != nil {
@@ -128,6 +129,11 @@ func fetchFeed() {
pDescription := item.Description
pDate := item.Date
if pDate != pDateOld {
+ if isFirstRun {
+ isFirstRun = false
+ pDateOld = pDate
+ continue
+ }
breakingNews := "🗨️ " + pTitle + " " + pDescription + "\n" + pLink
fmt.Println(breakingNews)
if err := sendMUCMessage(breakingNews); err != nil {