Browse Source

Merge branch 'more-error-logs' of kolaente/mensabot into master

master
Jonas Franz 3 years ago committed by Gitea
parent
commit
a991b5cfb9
  1. 6
      bot.go

6
bot.go

@ -95,6 +95,7 @@ func sendMealsForDate(s *discordgo.Session, t time.Time, channel string) { @@ -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) { @@ -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) { @@ -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