@@ 98,22 98,38 @@ func addDistrict(ctx *dgc.Ctx) {
}
arguments := ctx.Arguments
- arg := arguments.Get(0)
- name, err := AddTrackedDistrict(arg.Raw())
- if err != nil {
- log.Error(err.Error())
-
- if err := ctx.RespondText(err.Error()); err != nil {
+ if arguments.Amount() < 1 {
+ if err := ctx.RespondText("wrong number of arguments!"); err != nil {
log.Error(err)
}
return
}
- log.Infof("Added district %s to trackedDistricts", name)
+ names := make([]string, arguments.Amount())
+ for i := 0; i < arguments.Amount(); i++ {
+ name, err := AddTrackedDistrict(arguments.Get(i).Raw())
+ if err != nil {
+ log.Error(err)
+
+ if err := ctx.RespondText(err.Error()); err != nil {
+ log.Error(err)
+ }
- if err := ctx.RespondText(fmt.Sprintf("Added district %s.\n", name)); err != nil {
+ return
+ }
+ names[i] = name
+ }
+ log.Infof("Added the following districts to trackedDistricts: %v", names)
+
+ embed := discordgo.MessageEmbed{
+ Title: "Added districts",
+ Timestamp: time.Now().Format(time.RFC3339),
+ Description: strings.Join(names, ", "),
+ }
+
+ if err := ctx.RespondEmbed(&embed); err != nil {
log.Error(err)
}
}