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