multiple discord senders

This commit is contained in:
2026-01-20 20:58:18 +01:00
parent 76933a04d8
commit 53e6eecb3f
9 changed files with 100 additions and 69 deletions

View File

@@ -3,10 +3,16 @@ package lib
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func NewDiscordSender(webhook string, fake bool) DiscordSender {
return DiscordSender{
Webhook: webhook,
Fake: fake,
}
}
type DiscordSender struct {
Webhook string
Fake bool
@@ -19,13 +25,3 @@ func (d DiscordSender) Send(msg string) {
}
http.Post(d.Webhook, "application/json", bytes.NewBuffer(b))
}
func (d DiscordSender) SendBatch(msgs []string) {
for _, msg := range msgs {
log.Println("Sending to Discord:", msg)
if d.Fake {
continue
}
d.Send(msg)
}
}