20 lines
325 B
Go
20 lines
325 B
Go
package lib
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
type DiscordSender struct {
|
|
Config Config
|
|
}
|
|
|
|
func (d DiscordSender) Send(msg string) {
|
|
b, _ := json.Marshal(map[string]string{"content": msg})
|
|
if d.Config.DiscordFake {
|
|
return
|
|
}
|
|
http.Post(d.Config.DiscordWebhook, "application/json", bytes.NewBuffer(b))
|
|
}
|