Skip to content

Commit

Permalink
feat: log error
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincali committed May 15, 2024
1 parent ccaba01 commit 25ca348
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ func (config *Config) initMessage(bot *tgbotapi.BotAPI, configPath string) {
if err != nil {
log.Fatal(err)
}
os.WriteFile(configPath, yamlData, 0644)
log.Printf("%s saved messageId to config", tgPrefix)
err = os.WriteFile(configPath, yamlData, 0644)
if err != nil {
log.Printf("%s unable to save messageId %d to config, %s", tgPrefix, config.Telegram.MessageId, err)
} else {
log.Printf("%s saved messageId %d to config", tgPrefix, config.Telegram.MessageId)
}

// pin message
pinConfig := tgbotapi.PinChatMessageConfig{
Expand Down

0 comments on commit 25ca348

Please sign in to comment.