Skip to content

Commit d26fe8d

Browse files
committed
fix: emtpy birthday announce message
1 parent c564321 commit d26fe8d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

modules/birthday/handleCheck.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func Check(s *discordgo.Session) {
7474
}
7575

7676
// birthdayAnnounceEmbed returns the embed, that contains all birthdays and 'n' as the number of
77-
// birthdays, which is always len(b)
77+
// birthdays.
7878
func birthdayAnnounceEmbed(s *discordgo.Session, guildID string, b []birthdayEntry) (e *discordgo.MessageEmbed, n int) {
7979
var title, fValue string
8080

@@ -101,14 +101,15 @@ func birthdayAnnounceEmbed(s *discordgo.Session, guildID string, b []birthdayEnt
101101
format += "\n"
102102
fValue += fmt.Sprintf(format, member.Mention(), fmt.Sprint(b.Age()))
103103
}
104+
n++
104105
}
105106

106107
e = &discordgo.MessageEmbed{
107108
Title: title,
108109
Color: 0xFFD700,
109110
}
110111

111-
if len(b) == 0 {
112+
if n == 0 {
112113
e.Color = 0xFF0000
113114
e.Description = lang.Get(tp+"msg.announce.0.description", lang.FallbackLang())
114115
} else {
@@ -121,5 +122,5 @@ func birthdayAnnounceEmbed(s *discordgo.Session, guildID string, b []birthdayEnt
121122

122123
util.SetEmbedFooter(s, tp+"display", e)
123124

124-
return e, len(b)
125+
return e, n
125126
}

0 commit comments

Comments
 (0)