Documentation
¶
Index ¶
- Constants
- func AwaitingReplyToPath(awaitingReplyTo string) string
- func AwaitingReplyToQuery(awaitingReplyTo string) string
- func NewChatID(botID, botChatID string) string
- type BotChat
- type BotChatData
- func (e *BotChatData) AddClientLanguage(languageCode string) (changed bool)
- func (e *BotChatData) AddWizardParam(key, value string)
- func (e *BotChatData) GetAwaitingReplyTo() string
- func (e *BotChatData) GetBotID() string
- func (e *BotChatData) GetPreferredLanguage() string
- func (e *BotChatData) GetWizardParam(key string) string
- func (e *BotChatData) IsAwaitingReplyTo(code string) bool
- func (e *BotChatData) IsGroupChat() bool
- func (e *BotChatData) PopStepsFromAwaitingReplyUpToSpecificParent(step string)
- func (e *BotChatData) PushStepToAwaitingReplyTo(step string)
- func (e *BotChatData) SetAwaitingReplyTo(value string)
- func (e *BotChatData) SetBotID(botID string)
- func (e *BotChatData) SetBotUserID(id interface{})
- func (e *BotChatData) SetDtLastInteraction(v time.Time)
- func (e *BotChatData) SetDtUpdateToNow()
- func (e *BotChatData) SetIsGroupChat(v bool)
- func (e *BotChatData) SetPreferredLanguage(value string)
- type BotEntity
- type BotUser
- type BotUserData
- type WithAccessGrantedFlag
Constants ¶
const ( // AwaitingReplyToPathSeparator separates parts of the command state AwaitingReplyToPathSeparator = "/" // AwaitingReplyToPath2QuerySeparator separates path and query parts of state AwaitingReplyToPath2QuerySeparator = "?" // AwaitingReplyToParamsSeparator separates params of command state AwaitingReplyToParamsSeparator = "&" )
Variables ¶
This section is empty.
Functions ¶
func AwaitingReplyToPath ¶ added in v0.0.2
AwaitingReplyToPath returns just path part of command state
func AwaitingReplyToQuery ¶ added in v0.0.2
AwaitingReplyToQuery returns just query part of command state
Types ¶
type BotChat ¶
type BotChat interface {
GetBotID() string
SetBotID(botID string)
// GetAppUserID returns app user ID
GetAppUserID() string
SetAppUserIntID(id int64)
AddClientLanguage(languageCode string) (changed bool)
SetBotUserID(id interface{})
SetIsGroupChat(bool)
IsAccessGranted() bool
IsGroupChat() bool
SetAccessGranted(value bool) bool
GetPreferredLanguage() string
SetPreferredLanguage(value string)
SetUpdatedTime(time.Time) // github.com/strongo/user.UpdatedTimeSetter
SetDtLastInteraction(time time.Time)
GetAwaitingReplyTo() string
SetAwaitingReplyTo(path string)
IsAwaitingReplyTo(code string) bool
AddWizardParam(key, value string)
GetWizardParam(key string) string
PopStepsFromAwaitingReplyUpToSpecificParent(code string)
PushStepToAwaitingReplyTo(code string)
}
BotChat provides data about bot chat
type BotChatData ¶ added in v0.0.2
type BotChatData struct {
BotEntity
AppUserIntIDs []int64
BotID string `datastore:",noindex"`
//
IsGroup bool `datastore:",noindex,omitempty"`
Type string `datastore:",noindex,omitempty"`
Title string `datastore:",noindex,omitempty"`
//
AwaitingReplyTo string `datastore:",noindex,omitempty"`
PreferredLanguage string `datastore:",noindex,omitempty"`
GaClientID []byte `datastore:",noindex,omitempty"`
DtLastInteraction time.Time `datastore:",omitempty"`
InteractionsCount int `datastore:",omitempty"`
DtForbidden time.Time `datastore:",omitempty"`
DtForbiddenLast time.Time `datastore:",noindex,omitempty"`
LanguageCodes []string `datastore:",noindex"` // UI languages
}
BotChatData hold common properties for bot chat entities not specific to any platform
func (*BotChatData) AddClientLanguage ¶ added in v0.0.2
func (e *BotChatData) AddClientLanguage(languageCode string) (changed bool)
AddClientLanguage adds client UI language
func (*BotChatData) AddWizardParam ¶ added in v0.0.2
func (e *BotChatData) AddWizardParam(key, value string)
AddWizardParam adds context param to state
func (*BotChatData) GetAwaitingReplyTo ¶ added in v0.0.2
func (e *BotChatData) GetAwaitingReplyTo() string
GetAwaitingReplyTo returns current state
func (*BotChatData) GetBotID ¶ added in v0.0.2
func (e *BotChatData) GetBotID() string
GetBotID returns bot ID
func (*BotChatData) GetPreferredLanguage ¶ added in v0.0.2
func (e *BotChatData) GetPreferredLanguage() string
GetPreferredLanguage returns preferred language
func (*BotChatData) GetWizardParam ¶ added in v0.0.2
func (e *BotChatData) GetWizardParam(key string) string
GetWizardParam returns state param value
func (*BotChatData) IsAwaitingReplyTo ¶ added in v0.0.2
func (e *BotChatData) IsAwaitingReplyTo(code string) bool
IsAwaitingReplyTo returns true if bot us awaiting reply to a specific command
func (*BotChatData) IsGroupChat ¶ added in v0.0.2
func (e *BotChatData) IsGroupChat() bool
IsGroupChat indicates if it is a group chat
func (*BotChatData) PopStepsFromAwaitingReplyUpToSpecificParent ¶ added in v0.0.2
func (e *BotChatData) PopStepsFromAwaitingReplyUpToSpecificParent(step string)
PopStepsFromAwaitingReplyUpToSpecificParent go back in state
func (*BotChatData) PushStepToAwaitingReplyTo ¶ added in v0.0.2
func (e *BotChatData) PushStepToAwaitingReplyTo(step string)
PushStepToAwaitingReplyTo go down in state
func (*BotChatData) SetAwaitingReplyTo ¶ added in v0.0.2
func (e *BotChatData) SetAwaitingReplyTo(value string)
SetAwaitingReplyTo sets current state
func (*BotChatData) SetBotID ¶ added in v0.0.2
func (e *BotChatData) SetBotID(botID string)
SetBotID sets bot ID
func (*BotChatData) SetBotUserID ¶ added in v0.0.2
func (e *BotChatData) SetBotUserID(id interface{})
SetBotUserID sets bot user ID
func (*BotChatData) SetDtLastInteraction ¶ added in v0.0.2
func (e *BotChatData) SetDtLastInteraction(v time.Time)
SetDtLastInteraction sets date time of last interaction
func (*BotChatData) SetDtUpdateToNow ¶ added in v0.0.2
func (e *BotChatData) SetDtUpdateToNow()
SetDtUpdateToNow mark entity updated with now
func (*BotChatData) SetIsGroupChat ¶ added in v0.0.2
func (e *BotChatData) SetIsGroupChat(v bool)
SetIsGroupChat marks chat as a group one
func (*BotChatData) SetPreferredLanguage ¶ added in v0.0.2
func (e *BotChatData) SetPreferredLanguage(value string)
SetPreferredLanguage sets preferred language
type BotEntity ¶ added in v0.0.2
type BotEntity struct {
AccessGranted bool
user.OwnedByUserWithID
}
BotEntity holds properties common to al bot entities
func (*BotEntity) IsAccessGranted ¶ added in v0.0.2
IsAccessGranted indicates if access to the bot has been granted
func (*BotEntity) SetAccessGranted ¶ added in v0.0.2
SetAccessGranted mark that access has been granted
type BotUser ¶
type BotUser interface {
// GetAppUserID returns app user ID if available
GetAppUserID() string
// SetAppUserID sets app user ID to associate bot user record with app user
SetAppUserID(appUserID string)
WithAccessGrantedFlag
// SetUpdatedTime sets last updated time // TODO: document intended usage
SetUpdatedTime(time.Time) //to satisfy github.com/strongo/app/user.UpdatedTimeSetter
}
BotUser interface provides information about bot user This should be implemented by bot user record struct.
type BotUserData ¶ added in v0.0.2
type BotUserData struct {
BotEntity
user.LastLogin
FirstName string // required
LastName string // optional
UserName string // optional
}
BotUserData hold common properties for bot user entities