@@ 46,7 46,7 @@ func InitDiscordBot(s *discordgo.Session) {
router.RegisterCmd(&dgc.Command{
Name: "addDistricts",
- Description: "adds one or multiple districts to the tracked districts",
+ Description: "adds one or more districts to the tracked districts",
Usage: "addDistricts districtId/name",
Example: "addDistricts 05113 wolfsburg",
IgnoreCase: true,
@@ 54,12 54,12 @@ func InitDiscordBot(s *discordgo.Session) {
})
router.RegisterCmd(&dgc.Command{
- Name: "removeDistrict",
- Description: "remove a district from the tracked districts",
- Usage: "removeDistrict",
- Example: "removeDistrict",
+ Name: "removeDistricts",
+ Description: "remove one or more district from the tracked districts",
+ Usage: "removeDistricts districtId/name",
+ Example: "removeDistricts 05113 wolfsburg",
IgnoreCase: true,
- Handler: removeDistrict,
+ Handler: removeDistricts,
})
router.RegisterCmd(&dgc.Command{
@@ 134,28 134,38 @@ func addDistricts(ctx *dgc.Ctx) {
}
}
-func removeDistrict(ctx *dgc.Ctx) {
+func removeDistricts(ctx *dgc.Ctx) {
if !checkModerator(ctx) {
return
}
- arguments := ctx.Arguments
- arg := arguments.Get(0)
+ args := ctx.Arguments
- name, err := RemoveTrackedDistrict(arg.Raw())
- if err != nil {
- log.Error(err.Error())
+ names := make([]string, args.Amount())
+ for i := 0; i < args.Amount(); i++ {
+ name, err := RemoveTrackedDistrict(args.Get(i).Raw())
+ if err != nil {
+ log.Error(err.Error())
- if err := ctx.RespondText(err.Error()); err != nil {
- log.Error(err)
+ if err := ctx.RespondText(err.Error()); err != nil {
+ log.Error(err)
+ }
+
+ return
}
- return
+ names[i] = name
+ }
+
+ embed := discordgo.MessageEmbed{
+ Title: "Removed districts",
+ Timestamp: time.Now().Format(time.RFC3339),
+ Description: strings.Join(names, ", "),
}
- log.Infof("Removed district %s from trackedDistricts", name)
+ log.Infof("Removed the following districts from trackedDistricts: %v", names)
- if err := ctx.RespondText(fmt.Sprintf("Removed district %s.\n", name)); err != nil {
+ if err := ctx.RespondEmbed(&embed); err != nil {
log.Error(err)
}
}