Bot: Added arguments.Joined

This commit is contained in:
diamondburned (Forefront) 2020-05-04 00:14:11 -07:00
parent 25ecbb0ca5
commit d3574c2d7c
2 changed files with 21 additions and 3 deletions

View File

@ -24,9 +24,9 @@ type Usager interface {
}
// ManualParser has a ParseContent(string) method. If the library sees
// this for an argument, it will send all of the arguments (including the
// command) into the method. If used, this should be the only argument followed
// after the Message Create event. Any more and the router will ignore.
// this for an argument, it will send all of the arguments into the method. If
// used, this should be the only argument followed after the Message Create
// event. Any more and the router will ignore.
type ManualParser interface {
// $0 will have its prefix trimmed.
ParseContent([]string) error

View File

@ -0,0 +1,18 @@
package arguments
import (
"strings"
"github.com/diamondburned/arikawa/bot"
)
// Joined implements ManualParseable, in case you want all arguments but
// joined in a uniform way with spaces.
type Joined string
var _ bot.ManualParser = (*Joined)(nil)
func (j *Joined) ParseContent(args []string) error {
*j = Joined(strings.Join(args, " "))
return nil
}