19 lines
328 B
Go
19 lines
328 B
Go
package lib
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type DiscordSender struct {
|
|
Config Config
|
|
}
|
|
|
|
func (d DiscordSender) Send(msg string) {
|
|
fmt.Printf("Send to Discord: %s\n", msg)
|
|
b, _ := json.Marshal(map[string]string{"content": msg})
|
|
http.Post(d.Config.Webhook, "application/json", bytes.NewBuffer(b))
|
|
}
|