| Conditions | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | package telegram |
||
| 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 |