Skip to content

Commit 4a5de95

Browse files
committed
better poll args
1 parent cbc8a39 commit 4a5de95

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"log"
88
"os"
9-
"strings"
109
"time"
1110

1211
_ "github.com/mattn/go-sqlite3"
@@ -80,7 +79,7 @@ func initClient() (*whatsmeow.Client, *sqlstore.Container, waLog.Logger) {
8079
}
8180

8281
func main() {
83-
var jidStr, header, optionsStr, text string
82+
var jidStr, header, text string
8483
var message *waE2E.Message
8584
var client *whatsmeow.Client
8685
var container *sqlstore.Container
@@ -122,12 +121,11 @@ func main() {
122121
Arguments: []cli.Argument{
123122
&cli.StringArg{Name: "jid", Destination: &jidStr}, // use id field of group
124123
&cli.StringArg{Name: "header", Destination: &header},
125-
&cli.StringArg{Name: "options", Destination: &optionsStr},
124+
&cli.StringArgs{Name: "options", Min: 2, Max: -1},
126125
},
127126
Action: func(ctx context.Context, cmd *cli.Command) error {
128127
// parse JID
129-
var options = strings.Fields(optionsStr)
130-
message = client.BuildPollCreation(header, options, 1)
128+
message = client.BuildPollCreation(header, cmd.StringArgs("options"), 1)
131129
return nil
132130
},
133131
},

0 commit comments

Comments
 (0)