Documentation
¶
Index ¶
- func DoAction(name string, args map[string]interface{}, actions Actions, store ActionStore) (interface{}, error)
- type Action
- type ActionStore
- type Actions
- type Answer
- type DostowActionStore
- type DostowBot
- func (d *DostowBot) GetLastAnswer(message *whatsapp.TextMessage) (*Answer, error)
- func (d *DostowBot) HandleTextMessage(message whatsapp.TextMessage)
- func (d *DostowBot) MessageToMap(message *whatsapp.TextMessage) map[string]interface{}
- func (d *DostowBot) SendAnswer(q *Question, message *whatsapp.TextMessage, text string) error
- func (d *DostowBot) TriggerAction(action string, message *whatsapp.TextMessage, answer *Answer) (interface{}, error)
- type Error
- type Question
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Method string `json:"method"`
Store string `json:"store"`
Query map[string]interface{} `json:"query"`
Data map[string]interface{} `json:"data"`
Error *Error `json:"error"`
Next *Action `json:"next"`
}
Action an action that can be performed
type ActionStore ¶
ActionStore used to get information for action
type Answer ¶
type Answer struct {
ID string `json:"id"`
Action string `json:"action"`
Answer string `json:"answer"`
Created time.Time `json:"created_at"`
Modified time.Time `json:"modified_at"`
Question *Question `json:"question"`
Type string `json:"type"`
MessageText string `json:"messageText"`
MessageID string `json:"messageID"`
}
Answer stores an answer
type DostowActionStore ¶
type DostowActionStore struct {
// contains filtered or unexported fields
}
DostowActionStore an action store that uses dostow
func NewDostowActionStore ¶
func NewDostowActionStore(api *api.Client) *DostowActionStore
NewDostowActionStore create new store
type DostowBot ¶
type DostowBot struct {
*handlers.MessageHandler
// contains filtered or unexported fields
}
DostowBot a bot that uses dostow
func NewDostowBot ¶
func NewDostowBot(a *api.Client, questionStore, answerStore string, actions Actions, actionStore ActionStore, handler *handlers.MessageHandler) *DostowBot
NewDostowBot create a dostow bot with actions and a message handler
func (*DostowBot) GetLastAnswer ¶
func (d *DostowBot) GetLastAnswer(message *whatsapp.TextMessage) (*Answer, error)
GetLastAnswer get the last answer a whatsapp user sent
func (*DostowBot) HandleTextMessage ¶
func (d *DostowBot) HandleTextMessage(message whatsapp.TextMessage)
HandleTextMessage see MessageHandler.HandleTextMessage
func (*DostowBot) MessageToMap ¶
func (d *DostowBot) MessageToMap(message *whatsapp.TextMessage) map[string]interface{}
MessageToMap convert message to map
func (*DostowBot) SendAnswer ¶
SendAnswer send a text message
func (*DostowBot) TriggerAction ¶
func (d *DostowBot) TriggerAction(action string, message *whatsapp.TextMessage, answer *Answer) (interface{}, error)
TriggerAction trigger an action
type Question ¶
type Question struct {
ID string `json:"id"`
Action string `json:"action"`
Answer string `json:"answer"`
Created time.Time `json:"created_at"`
Modified time.Time `json:"modified_at"`
Next *Question `json:"next"`
Question string `json:"question"`
Type string `json:"type"`
}
Question stores a question
Click to show internal directories.
Click to hide internal directories.