Skip sending Telegram message if bot is not initialized
This commit is contained in:
parent
a8f8550a66
commit
95a9e4af5b
1 changed files with 5 additions and 0 deletions
|
@ -51,7 +51,12 @@ func (tn *TelegramNotifier) SendChoreReminder(c context.Context, chore *chModel.
|
|||
}
|
||||
|
||||
func (tn *TelegramNotifier) SendChoreCompletion(c context.Context, chore *chModel.Chore, user *uModel.User) {
|
||||
|
||||
log := logging.FromContext(c)
|
||||
if tn == nil {
|
||||
log.Error("Telegram bot is not initialized, Skipping sending message")
|
||||
return
|
||||
}
|
||||
var mt *chModel.NotificationMetadata
|
||||
if err := json.Unmarshal([]byte(*chore.NotificationMetadata), &mt); err != nil {
|
||||
log.Error("Error unmarshalling notification metadata", err)
|
||||
|
|
Loading…
Add table
Reference in a new issue