bot

package
v0.0.0-...-b22b278 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ActionURLSuffix = "/action"
View Source
const LivelinessSuffix = "/_healthz"

Variables

This section is empty.

Functions

func ParseQuestion

func ParseQuestion(script ScriptYaml, state ScriptState)

func ProcessString

func ProcessString(in interface{}) string

Types

type Bot

type Bot struct {
	ChatDomain    string
	CallbackURL   string
	ChannelPrefix string
	ExternalURL   string
	IsOnline      bool
	// contains filtered or unexported fields
}

func (*Bot) ActionHandler

func (b *Bot) ActionHandler(w http.ResponseWriter, r *http.Request)

func (*Bot) AwaitMessages

func (b *Bot) AwaitMessages()

func (*Bot) Connect

func (b *Bot) Connect(authToken string)

func (*Bot) CreatePost

func (b *Bot) CreatePost(c *model.Channel, line string, props model.StringInterface)

func (*Bot) Disconnect

func (b *Bot) Disconnect()

func (*Bot) FindBotChannel

func (b *Bot) FindBotChannel(configChannelName string, adminUsername string)

func (*Bot) GetNameIconForChannel

func (b *Bot) GetNameIconForChannel(c *model.Channel) (string, string)

func (*Bot) GetTextAnswer

func (b *Bot) GetTextAnswer(q *ScriptAnswer, c *model.Channel) string

func (*Bot) GetTextQuestion

func (b *Bot) GetTextQuestion(q *ScriptQuestion, c *model.Channel) string

func (*Bot) HandleJoinedUser

func (b *Bot) HandleJoinedUser(u *model.User)

func (*Bot) LoadScript

func (b *Bot) LoadScript()

func (*Bot) LoginAsTheBotUser

func (b *Bot) LoginAsTheBotUser(authToken string)

func (*Bot) MakeSureServerIsRunning

func (b *Bot) MakeSureServerIsRunning()

func (*Bot) PrintQuestion

func (b *Bot) PrintQuestion(c *model.Channel, q *ScriptQuestion, disablePostID string)

func (*Bot) Register

func (b *Bot) Register()

func (*Bot) SetChannelPropsForTargetUser

func (b *Bot) SetChannelPropsForTargetUser(u *model.User, c *model.Channel)

func (*Bot) StartActionsHTTPd

func (b *Bot) StartActionsHTTPd(bindIP string, bindPort string)

func (*Bot) StartConversation

func (b *Bot) StartConversation(c *model.Channel)

func (*Bot) UserTyping

func (b *Bot) UserTyping(c *model.Channel)

type ScriptAnswer

type ScriptAnswer struct {
	ID                string
	ResponseEng       string
	ResponseHebMale   string
	ResponseHebFemale string
}

type ScriptQuestion

type ScriptQuestion struct {
	ID                string
	Special           string
	QuestionEng       string
	QuestionHebMale   string
	QuestionHebFemale string
	Link              string
	AnswerOrder       []string
	Answer            map[string]*ScriptAnswer
}

type ScriptState

type ScriptState struct {
	Questions   map[string]*ScriptQuestion
	Specials    map[string][]*ScriptQuestion
	FromActions map[string]*ScriptQuestion
}

type ScriptYaml

type ScriptYaml struct {
	ID                string                `yaml:"i"`
	Special           string                `yaml:"s"`
	QuestionEng       interface{}           `yaml:"q"`
	QuestionHebMale   interface{}           `yaml:"qm"`
	QuestionHebFemale interface{}           `yaml:"qf"`
	ResponseEng       string                `yaml:"r"`
	ResponseHebMale   string                `yaml:"rm"`
	ResponseHebFemale string                `yaml:"rf"`
	Link              string                `yaml:"l"`
	Answer            map[string]ScriptYaml `yaml:"a"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL