telegram additional description and fix

pull/702/head
hunterlong 2020-06-26 18:12:12 -07:00
parent 507c42f07e
commit 3330161d17
2 changed files with 8 additions and 8 deletions

View File

@ -13,6 +13,7 @@
- Added core.Example() function for testing
- Added Custom oAuth Authentication method
- Fixed setup form not creating user from values inputted in form
- Fixed issues with Telegram Notifier
# 0.90.55 (06-18-2020)
- Added 404 page

View File

@ -45,9 +45,9 @@ var Telegram = &telegram{&notifications.Notification{
Required: true,
}, {
Type: "text",
Title: "Channel or User",
Title: "Channel",
Placeholder: "@statping_channel",
SmallText: "Insert your Telegram Channel or User here.",
SmallText: "Insert your Telegram Channel including the @ symbol. The bot will need to be an administrator of this channel.",
DbField: "var1",
Required: true,
}}},
@ -60,9 +60,8 @@ func (t *telegram) sendMessage(message string) (string, error) {
v := url.Values{}
v.Set("chat_id", t.Var1)
v.Set("text", message)
rb := *strings.NewReader(v.Encode())
contents, _, err := utils.HttpRequest(apiEndpoint, "GET", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second), true, nil)
contents, _, err := utils.HttpRequest(apiEndpoint, "POST", "application/x-www-form-urlencoded", nil, strings.NewReader(v.Encode()), time.Duration(10*time.Second), true, nil)
success, _ := telegramSuccess(contents)
if !success {
@ -89,14 +88,14 @@ func (t *telegram) OnSuccess(s services.Service) (string, error) {
// OnTest will test the Twilio SMS messaging
func (t *telegram) OnTest() (string, error) {
msg := fmt.Sprintf("Testing the Twilio SMS Notifier on your Statping server")
content, err := t.sendMessage(msg)
return content, err
msg := fmt.Sprintf("Testing the Telegram Notifier on your Statping server")
return t.sendMessage(msg)
}
// OnSave will trigger when this notifier is saved
func (t *telegram) OnSave() (string, error) {
return "", nil
msg := fmt.Sprintf("The Telegram Notifier on your Statping server was just saved")
return t.sendMessage(msg)
}
func telegramSuccess(res []byte) (bool, telegramResponse) {