mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-04-15 09:44:28 +00:00
Bot: Added arguments.Joined
This commit is contained in:
parent
25ecbb0ca5
commit
d3574c2d7c
|
@ -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
|
||||
|
|
18
bot/extras/arguments/arguments.go
Normal file
18
bot/extras/arguments/arguments.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue