diff --git a/discord/coords_translation.go b/discord/coords_translation.go index 22ed5ef..1075604 100644 --- a/discord/coords_translation.go +++ b/discord/coords_translation.go @@ -83,7 +83,7 @@ func (s *Session) translateCoords(ctx *commandCtx, m *discordgo.MessageCreate) { if ctx.server.CoordsTranslation == "" { return } - coords := extractAllCoordsFromMessage(m.Content) + coords := coordsRegex.FindAllString(m.Content, -1) coordsLen := len(coords) if coordsLen > 0 { version, err := s.cfg.API.Version.Read(tw.VersionCodeFromServerKey(ctx.server.CoordsTranslation)) @@ -147,11 +147,3 @@ func (s *Session) translateCoords(ctx *commandCtx, m *discordgo.MessageCreate) { MessageEmbed) } } - -func extractAllCoordsFromMessage(msg string) []string { - coords := []string{} - for _, bytes := range coordsRegex.FindAll([]byte(msg), -1) { - coords = append(coords, string(bytes)) - } - return coords -}