moved notifiers to seperate section in config
This commit is contained in:
parent
25cf91966e
commit
23bb6459ff
1 changed files with 3 additions and 3 deletions
|
@ -14,19 +14,19 @@ type TelegramNotifier struct {
|
|||
}
|
||||
|
||||
func (telegram *TelegramNotifier) Open() bool {
|
||||
bot, err := tgbotapi.NewBotAPI(viper.GetString("telegram.token"))
|
||||
bot, err := tgbotapi.NewBotAPI(viper.GetString("notifiers.telegram.token"))
|
||||
if err != nil {
|
||||
log.Println("Could not start Telegram notifier:\n", err)
|
||||
return false
|
||||
}
|
||||
telegram.Bot = bot
|
||||
bot.Debug = viper.GetBool("telegram.debug")
|
||||
bot.Debug = viper.GetBool("notifiers.telegram.debug")
|
||||
log.Printf("Authorized telegram bot: %s", bot.Self.UserName)
|
||||
return true
|
||||
}
|
||||
|
||||
func (telegram *TelegramNotifier) Message(message string) bool {
|
||||
msg := tgbotapi.NewMessage(viper.GetInt64("telegram.chat"), message)
|
||||
msg := tgbotapi.NewMessage(viper.GetInt64("notifiers.telegram.chat"), message)
|
||||
_, err := telegram.Bot.Send(msg)
|
||||
if err != nil {
|
||||
log.Println("Could not send Telegram message:\n", err)
|
||||
|
|
Loading…
Add table
Reference in a new issue