Move rpn logic to separate package
This commit is contained in:
parent
ac46753546
commit
b8ee6a1505
@ -5,8 +5,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"djpianalto.com/goff/djpianalto.com/goff/utils"
|
|
||||||
"github.com/dustinpianalto/disgoman"
|
"github.com/dustinpianalto/disgoman"
|
||||||
|
"github.com/dustinpianalto/rpnparse"
|
||||||
)
|
)
|
||||||
|
|
||||||
func interleave(ctx disgoman.Context, args []string) {
|
func interleave(ctx disgoman.Context, args []string) {
|
||||||
@ -52,7 +52,7 @@ func deinterleave(ctx disgoman.Context, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateRPNCommand(ctx disgoman.Context, args []string) {
|
func generateRPNCommand(ctx disgoman.Context, args []string) {
|
||||||
rpn, err := utils.GenerateRPN(args)
|
rpn, err := rpnparse.GenerateRPN(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(err.Error())
|
ctx.Send(err.Error())
|
||||||
return
|
return
|
||||||
@ -61,7 +61,7 @@ func generateRPNCommand(ctx disgoman.Context, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseRPNCommand(ctx disgoman.Context, args []string) {
|
func parseRPNCommand(ctx disgoman.Context, args []string) {
|
||||||
res, err := utils.ParseRPN(args)
|
res, err := rpnparse.ParseRPN(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(err.Error())
|
ctx.Send(err.Error())
|
||||||
return
|
return
|
||||||
@ -70,12 +70,12 @@ func parseRPNCommand(ctx disgoman.Context, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func solveCommand(ctx disgoman.Context, args []string) {
|
func solveCommand(ctx disgoman.Context, args []string) {
|
||||||
rpn, err := utils.GenerateRPN(args)
|
rpn, err := rpnparse.GenerateRPN(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(err.Error())
|
ctx.Send(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res, err := utils.ParseRPN(strings.Split(rpn, " "))
|
res, err := rpnparse.ParseRPN(strings.Split(rpn, " "))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(err.Error())
|
ctx.Send(err.Error())
|
||||||
return
|
return
|
||||||
|
|||||||
1
go.mod
1
go.mod
@ -5,6 +5,7 @@ go 1.14
|
|||||||
require (
|
require (
|
||||||
github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de
|
github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de
|
||||||
github.com/dustinpianalto/disgoman v0.0.10
|
github.com/dustinpianalto/disgoman v0.0.10
|
||||||
|
github.com/dustinpianalto/rpnparse v1.0.0
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
github.com/lib/pq v1.3.0
|
github.com/lib/pq v1.3.0
|
||||||
github.com/olebedev/when v0.0.0-20190311101825-c3b538a97254
|
github.com/olebedev/when v0.0.0-20190311101825-c3b538a97254
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user