telegram/telegram.go   A
last analyzed

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
cc 2
eloc 14
dl 0
loc 23
ccs 0
cts 8
cp 0
crap 6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A telegram.SendMessage 0 13 2
1
package telegram
2
3
import (
4
	"os"
5
6
	"github.com/SerhiiCho/shoshka-go/utils"
7
	tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
8
)
9
10
// SendMessage sends message in telegram chat
11
func SendMessage(message string) {
12
	if len(message) == 0 {
13
		return
14
	}
15
16
	bot, err := tgbotapi.NewBotAPI(os.Getenv("BOT_TOKEN"))
17
	utils.HandleError(err, "Bot init error")
18
19
	msg := tgbotapi.NewMessage(getChatID(), message)
20
	msg.DisableWebPagePreview = true
21
22
	_, err = bot.Send(msg)
23
	utils.HandleError(err, "Error sending telegram message")
24
}
25