mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
interaction: add PrivateCommand
This commit is contained in:
parent
76c64b041f
commit
a6fb0caff3
|
@ -30,7 +30,6 @@ const (
|
||||||
StateAuthenticated State = "authenticated"
|
StateAuthenticated State = "authenticated"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type TextMessageResponder interface {
|
type TextMessageResponder interface {
|
||||||
SetTextMessageResponder(responder Responder)
|
SetTextMessageResponder(responder Responder)
|
||||||
}
|
}
|
||||||
|
@ -47,8 +46,12 @@ type Messenger interface {
|
||||||
|
|
||||||
// Interact implements the interaction between bot and message software.
|
// Interact implements the interaction between bot and message software.
|
||||||
type Interact struct {
|
type Interact struct {
|
||||||
|
// commands is the default public command map
|
||||||
commands map[string]*Command
|
commands map[string]*Command
|
||||||
|
|
||||||
|
// privateCommands is the private command map, need auth
|
||||||
|
privateCommands map[string]*Command
|
||||||
|
|
||||||
states map[State]State
|
states map[State]State
|
||||||
statesFunc map[State]interface{}
|
statesFunc map[State]interface{}
|
||||||
|
|
||||||
|
@ -75,6 +78,12 @@ func (i *Interact) AddCustomInteraction(custom CustomInteraction) {
|
||||||
custom.Commands(i)
|
custom.Commands(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Interact) PrivateCommand(command string, f interface{}) *Command {
|
||||||
|
cmd := NewCommand(command, f)
|
||||||
|
i.commands[command] = cmd
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
func (i *Interact) Command(command string, f interface{}) *Command {
|
func (i *Interact) Command(command string, f interface{}) *Command {
|
||||||
cmd := NewCommand(command, f)
|
cmd := NewCommand(command, f)
|
||||||
i.commands[command] = cmd
|
i.commands[command] = cmd
|
||||||
|
|
Loading…
Reference in New Issue
Block a user