Skip to content

Commit 5f93c19

Browse files
author
anh.bui
committed
change env variable
1 parent 0818227 commit 5f93c19

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

plugin.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ import (
1515
// GetGotifyPluginInfo returns gotify plugin info
1616
func GetGotifyPluginInfo() plugin.Info {
1717
return plugin.Info{
18-
Name: "Gotify 2 Telegram",
18+
Version: "1.0",
19+
Author: "Anh Bui",
20+
Name: "Gotify 2 Telegram",
21+
Description: "Telegram message fowarder for gotify",
1922
ModulePath: "https://github.com/anhbh310/gotify2telegram",
20-
Author: "Anh Bui",
23+
2124
}
2225
}
2326

@@ -26,7 +29,7 @@ type Plugin struct {
2629
ws *websocket.Conn;
2730
msgHandler plugin.MessageHandler;
2831
chatid string;
29-
telegram_api_token string;
32+
telegram_bot_token string;
3033
gotify_host string;
3134
}
3235

@@ -57,7 +60,7 @@ func (p *Plugin) send_msg_to_telegram(msg string) {
5760
}
5861
body := bytes.NewReader(payloadBytes)
5962

60-
req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+ p.telegram_api_token +"/sendMessage", body)
63+
req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+ p.telegram_bot_token +"/sendMessage", body)
6164
if err != nil {
6265
fmt.Println("Create request false")
6366
return
@@ -87,7 +90,7 @@ func (p *Plugin) connect_websocket() {
8790
func (p *Plugin) get_websocket_msg(url string, token string) {
8891
p.gotify_host = url + "/stream?token=" + token
8992
p.chatid = os.Getenv("TELEGRAM_CHAT_ID")
90-
p.telegram_api_token = os.Getenv("TELEGRAM_API_TOKEN")
93+
p.telegram_bot_token = os.Getenv("TELEGRAM_BOT_TOKEN")
9194

9295
go p.connect_websocket()
9396

0 commit comments

Comments
 (0)