Documentation
ΒΆ
Index ΒΆ
- Variables
- func ActionAudio(flow *Flow, channel Channel) (bool, error)
- func ActionButton(flow *Flow, channel Channel) (bool, error)
- func ActionDocument(flow *Flow, channel Channel) (bool, error)
- func ActionImage(flow *Flow, channel Channel) (bool, error)
- func ActionInput(flow *Flow, channel Channel) (bool, error)
- func ActionText(flow *Flow, channel Channel) (bool, error)
- func ActionVideo(flow *Flow, channel Channel) (bool, error)
- func ActionWait(flow *Flow, channel Channel) (bool, error)
- func FormatTestError(expect, have interface{}) string
- func Int64ToString(number int64) string
- func IsURL(str string) bool
- func ParseTemplate(texts []string) string
- func RunAction(flow *Flow, channel Channel) (bool, error)
- func SetCustomActions(custom ActionsMap)
- func StartBot(base *Flow, channel Channel, persist Persist) error
- func StringToInt64(str string) int64
- type ActionsMap
- type Channel
- type Discord
- func (ds *Discord) Next(in chan *Interaction)
- func (ds *Discord) RespondInteraction(in *discordgo.Interaction)
- func (ds *Discord) SendAudio(interaction *Interaction) error
- func (ds *Discord) SendButton(interaction *Interaction) error
- func (ds *Discord) SendDocument(interaction *Interaction) error
- func (ds *Discord) SendFile(sessionID, text, path string) error
- func (ds *Discord) SendImage(interaction *Interaction) error
- func (ds *Discord) SendText(interaction *Interaction) error
- func (ds *Discord) SendVideo(interaction *Interaction) error
- type Flow
- type Interaction
- func NewInteractionMessageAudio(sessionID string, audio string, text string) *Interaction
- func NewInteractionMessageButton(sessionID string, buttons []string, text string) *Interaction
- func NewInteractionMessageDocument(sessionID string, document string, text string) *Interaction
- func NewInteractionMessageImage(sessionID string, image string, text string) *Interaction
- func NewInteractionMessageText(sessionID string, text string) *Interaction
- func NewInteractionMessageVideo(sessionID string, video string, text string) *Interaction
- type InteractionParameters
- type InteractionType
- type Local
- type Persist
- type Step
- type StepParameters
- type Steps
- type Telegram
- func (tg *Telegram) Next(interaction chan *Interaction)
- func (tg *Telegram) SendAudio(interaction *Interaction) error
- func (tg *Telegram) SendButton(interaction *Interaction) error
- func (tg *Telegram) SendDocument(interaction *Interaction) error
- func (tg *Telegram) SendImage(interaction *Interaction) error
- func (tg *Telegram) SendText(interaction *Interaction) error
- func (tg *Telegram) SendVideo(interaction *Interaction) error
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ( ERR_UNKNOWN_TELEGRAM_TOKEN = errors.New("unknown TELEGRAM_TOKEN") ERR_UNKNOWN_DISCORD_TOKEN = errors.New("unknown DISCORD_TOKEN") ERR_UNKNOWN_ACTION = errors.New("unknown action") ERR_NIL_FLOW = errors.New("nil flow") ERR_NIL_STEP = errors.New("nil step") ERR_UNKNOWN_DEFAULT_STEP = errors.New("unknown step: default") ERR_UNKNOWN_INIT_STEP = errors.New("unknown step: init") ERR_UNKNOWN_NEXT_STEP = errors.New("unknown next step") ERR_PATTERN_NEXT_STEP = errors.New("step pattern invalid") )
View Source
var Debug = true
View Source
var EnableLocalPersist = true
Functions ΒΆ
func FormatTestError ΒΆ
func FormatTestError(expect, have interface{}) string
func Int64ToString ΒΆ
func ParseTemplate ΒΆ
func SetCustomActions ΒΆ added in v1.1.0
func SetCustomActions(custom ActionsMap)
func StringToInt64 ΒΆ
Types ΒΆ
type Channel ΒΆ
type Channel interface {
SendAudio(*Interaction) error
SendButton(*Interaction) error
SendDocument(*Interaction) error
SendImage(*Interaction) error
SendText(*Interaction) error
SendVideo(*Interaction) error
Next(chan *Interaction)
}
func NewDiscord ΒΆ added in v1.4.0
func NewTelegram ΒΆ
type Discord ΒΆ added in v1.4.0
type Discord struct {
// contains filtered or unexported fields
}
func (*Discord) Next ΒΆ added in v1.4.0
func (ds *Discord) Next(in chan *Interaction)
func (*Discord) RespondInteraction ΒΆ added in v1.4.0
func (ds *Discord) RespondInteraction(in *discordgo.Interaction)
func (*Discord) SendAudio ΒΆ added in v1.4.0
func (ds *Discord) SendAudio(interaction *Interaction) error
func (*Discord) SendButton ΒΆ added in v1.4.0
func (ds *Discord) SendButton(interaction *Interaction) error
func (*Discord) SendDocument ΒΆ added in v1.4.0
func (ds *Discord) SendDocument(interaction *Interaction) error
func (*Discord) SendImage ΒΆ added in v1.4.0
func (ds *Discord) SendImage(interaction *Interaction) error
func (*Discord) SendText ΒΆ added in v1.4.0
func (ds *Discord) SendText(interaction *Interaction) error
func (*Discord) SendVideo ΒΆ added in v1.4.0
func (ds *Discord) SendVideo(interaction *Interaction) error
type Flow ΒΆ
type Flow struct {
SessionID string
Name string `yaml:"name"`
Steps Steps `yaml:"steps"`
Current *Step
}
func (*Flow) Next ΒΆ
func (flow *Flow) Next(interaction *Interaction) error
type Interaction ΒΆ
type Interaction struct {
SessionID string `json:"sessionID"`
Type InteractionType `json:"type"`
Parameters InteractionParameters `json:"parameters"`
Custom map[string]any `json:"custom"`
}
func NewInteractionMessageAudio ΒΆ
func NewInteractionMessageAudio(sessionID string, audio string, text string) *Interaction
func NewInteractionMessageButton ΒΆ
func NewInteractionMessageButton(sessionID string, buttons []string, text string) *Interaction
func NewInteractionMessageDocument ΒΆ
func NewInteractionMessageDocument(sessionID string, document string, text string) *Interaction
func NewInteractionMessageImage ΒΆ
func NewInteractionMessageImage(sessionID string, image string, text string) *Interaction
func NewInteractionMessageText ΒΆ
func NewInteractionMessageText(sessionID string, text string) *Interaction
func NewInteractionMessageVideo ΒΆ
func NewInteractionMessageVideo(sessionID string, video string, text string) *Interaction
type InteractionParameters ΒΆ
type InteractionParameters StepParameters
type InteractionType ΒΆ
type InteractionType string
const ( MESSAGE InteractionType = "message" EVENT InteractionType = "event" )
type Persist ΒΆ added in v1.4.0
func NewLocalPersist ΒΆ added in v1.4.0
type Step ΒΆ
type Step struct {
Action string `yaml:"action"`
Next map[string]string `yaml:"next"`
Parameters StepParameters `yaml:"parameters"`
Responses []*Interaction
}
func (*Step) AddResponse ΒΆ added in v1.4.0
func (step *Step) AddResponse(interaction *Interaction)
func (*Step) GetLastResponse ΒΆ added in v1.4.2
func (step *Step) GetLastResponse() *Interaction
func (*Step) GetLastResponseText ΒΆ added in v1.4.2
type StepParameters ΒΆ
type StepParameters struct {
Audio string `yaml:"audio" json:"audio"`
Buttons []string `yaml:"buttons" json:"buttons"`
Document string `yaml:"document" json:"document"`
Image string `yaml:"image" json:"image"`
Text string `yaml:"text" json:"text"`
Texts []string `yaml:"texts"`
Video string `yaml:"video" json:"video"`
}
type Telegram ΒΆ
type Telegram struct {
// contains filtered or unexported fields
}
func (*Telegram) Next ΒΆ
func (tg *Telegram) Next(interaction chan *Interaction)
func (*Telegram) SendAudio ΒΆ
func (tg *Telegram) SendAudio(interaction *Interaction) error
func (*Telegram) SendButton ΒΆ
func (tg *Telegram) SendButton(interaction *Interaction) error
func (*Telegram) SendDocument ΒΆ
func (tg *Telegram) SendDocument(interaction *Interaction) error
func (*Telegram) SendImage ΒΆ
func (tg *Telegram) SendImage(interaction *Interaction) error
func (*Telegram) SendText ΒΆ
func (tg *Telegram) SendText(interaction *Interaction) error
func (*Telegram) SendVideo ΒΆ
func (tg *Telegram) SendVideo(interaction *Interaction) error
Source Files
ΒΆ
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
docs
|
|
|
examples/dungeon
command
|
|
|
examples/hello
command
|
|
|
examples/pingpong
command
|
|
|
examples/tabnews
command
|
Click to show internal directories.
Click to hide internal directories.