Skip to content

Commit

Permalink
feat: disable notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincali committed May 15, 2024
1 parent 25ca348 commit 2cfef1a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ func (config *Config) initMessage(bot *tgbotapi.BotAPI, configPath string) {
log.Printf("no messageId specified in config")

// send message
initChattable := tgbotapi.NewMessage(config.Telegram.ChatId, "init")
initChattable := tgbotapi.MessageConfig{
BaseChat: tgbotapi.BaseChat{
ChatID: config.Telegram.ChatId,
DisableNotification: true,
},
Text: "init",
}
initMsg, err := bot.Send(initChattable)
if err != nil {
log.Fatal(err)
}
log.Printf("%s sent message", tgPrefix)
log.Printf("%s sent init message", tgPrefix)

// save messageId to config
config.Telegram.MessageId = initMsg.MessageID
Expand All @@ -60,7 +66,7 @@ func (config *Config) initMessage(bot *tgbotapi.BotAPI, configPath string) {
ChatID: config.Telegram.ChatId,
ChannelUsername: "",
MessageID: config.Telegram.MessageId,
DisableNotification: false,
DisableNotification: true,
}
bot.Send(pinConfig)
log.Printf("%s pinned message", tgPrefix)
Expand Down

0 comments on commit 2cfef1a

Please sign in to comment.