Skip to content

Commit

Permalink
fix: remove incorrect empty notification messages
Browse files Browse the repository at this point in the history
  • Loading branch information
zzucch committed Sep 18, 2024
1 parent 9673f36 commit fd9b7dd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion internal/bot/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (b *Bot) handleNotifications() {
}
}

log.Debug("lk", "l", notification.Updates)
if len(notification.Updates) > 0 {
for _, update := range notification.Updates {
updateStorage(b.store, notification.ChatID, update)
Expand Down
2 changes: 1 addition & 1 deletion internal/bot/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func updateStorage(
chatID int64,
update notification.Update,
) {
if update.LatestTimestamp != 0 {
if update.LatestTimestamp != -1 {
if err := store.SetLatestSubtitleTimestamp(
chatID,
update.TitleID,
Expand Down
8 changes: 5 additions & 3 deletions internal/notification/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ func notify(
err)
}

message := getUpdateMessage(subscription, update, err)
notificationMessageSB.WriteString(message)
if update.LatestTimestamp != -1 {
message := getUpdateMessage(subscription, update, err)
notificationMessageSB.WriteString(message)
}

if err == nil {
if update.LatestTimestamp != 0 || update.JapaneseName != "" {
if update.LatestTimestamp != -1 || update.JapaneseName != "" {
updates = append(updates, update)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/notification/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func getUpdate(
var newFileEntryNames []string

if subscription.LastModified == lastModified {
lastModified = 0
lastModified = -1
} else {
fileEntries, err := client.GetFileEntries(subscription.TitleID)
if err != nil {
Expand Down

0 comments on commit fd9b7dd

Please sign in to comment.