in progress

This commit is contained in:
Vladimir V Maksimov
2025-10-25 21:11:46 +03:00
parent 17aff5a9a8
commit 68310ac711
5 changed files with 114 additions and 0 deletions

37
telegram_test.go Normal file
View File

@@ -0,0 +1,37 @@
package notify_test
import (
"log"
"os"
"testing"
"git.gm6.ru/icewind/notify"
"gopkg.in/yaml.v2"
)
type ConfigTelegram struct {
GroupID int64 `yaml:"group_id"`
Token string `yaml:"token"`
}
func TestMessage(t *testing.T) {
cData, err := os.ReadFile("test_data/telegram.yaml")
if err != nil {
t.Fatal(err)
}
var conf ConfigTelegram
if err = yaml.Unmarshal(cData, &conf); err != nil {
t.Fatal(err)
}
log.Println(conf)
bot, err := notify.NewTelegram(conf.Token, true)
if err != nil {
t.Fatal(err)
}
m, err := bot.SendTextMessage(conf.GroupID, "Привет ))")
if err != nil {
t.Fatal(err)
}
t.Log(m)
}