Add more logging for errors

pull/10/head
kolaente 4 years ago
parent ac89ce4c35
commit 9b4ec5f74f
Signed by untrusted user: kolaente
GPG Key ID: F40E70337AB24C9B
  1. 6
      bot.go

@ -95,6 +95,7 @@ func sendMealsForDate(s *discordgo.Session, t time.Time, channel string) {
meals, err := canteen.GetMeals(t)
if err != nil {
s.ChannelMessageSend(channel, ":angry: an error occured")
fmt.Println("an error occured while getting the meals: ", err)
return
}
var messages = make([]*discordgo.MessageEmbedField, len(meals))
@ -124,7 +125,7 @@ func sendMealsForDate(s *discordgo.Session, t time.Time, channel string) {
footer += fmt.Sprintf("[%d] %s\n", i+1, strings.Join(meal.Notes, ", "))
}
}
s.ChannelMessageSendComplex(channel, &discordgo.MessageSend{
_, err = s.ChannelMessageSendComplex(channel, &discordgo.MessageSend{
Embed: &discordgo.MessageEmbed{
Title: fmt.Sprintf("**Menü vom %s**", t.Format("02.01.2006")),
Fields: messages,
@ -134,4 +135,7 @@ func sendMealsForDate(s *discordgo.Session, t time.Time, channel string) {
},
},
})
if err != nil {
fmt.Println("an error occured while sending the meals: ", err)
}
}

Loading…
Cancel
Save