@@ 187,17 187,18 @@ func getTrackedDistricts(ctx *dgc.Ctx) {
return
}
- var sb strings.Builder
+ names := make([]string, len(districts))
for i, district := range districts {
- sb.WriteString(district.Name)
+ names[i] = district.Name
+ }
- // only append a comma if it's not the last element
- if i < len(districts)-1 {
- sb.WriteString(", ")
- }
+ embed := discordgo.MessageEmbed{
+ Title: "Tracked districts",
+ Description: strings.Join(names, ", "),
+ Timestamp: time.Now().Format(time.RFC3339),
}
- if err := ctx.RespondText(sb.String()); err != nil {
+ if err := ctx.RespondEmbed(&embed); err != nil {
log.Error(err)
}
}