Fix bug with shellquote

pull/1/head
DustyP 6 years ago
parent 8ec0dfe0c2
commit 56e0c849b2

@ -1,19 +1,23 @@
package exts package exts
import ( import (
"djpianalto.com/goff/djpianalto.com/goff/utils"
"errors" "errors"
"fmt" "fmt"
"github.com/dustinpianalto/disgoman"
"github.com/kballard/go-shellquote"
"log" "log"
"strings" "strings"
"djpianalto.com/goff/djpianalto.com/goff/utils"
"github.com/dustinpianalto/disgoman"
"github.com/kballard/go-shellquote"
) )
func addTagCommand(ctx disgoman.Context, args []string) { func addTagCommand(ctx disgoman.Context, args []string) {
if len(args) >= 1 { if len(args) >= 1 {
args, err := shellquote.Split(strings.Join(args, " ")) args, err := shellquote.Split(strings.Join(args, " "))
if err != nil { if err != nil {
if strings.Contains(err.Error(), "Unterminated") {
args = strings.SplitN(strings.Join(args, " "), " ", 2)
} else {
ctx.ErrorChannel <- disgoman.CommandError{ ctx.ErrorChannel <- disgoman.CommandError{
Context: ctx, Context: ctx,
Message: "", Message: "",
@ -21,6 +25,7 @@ func addTagCommand(ctx disgoman.Context, args []string) {
} }
return return
} }
}
queryString := `SELECT tags.id, tags.tag, tags.content from tags queryString := `SELECT tags.id, tags.tag, tags.content from tags
WHERE tags.guild_id = $1 WHERE tags.guild_id = $1
AND tags.tag = $2;` AND tags.tag = $2;`

Loading…
Cancel
Save