botsfwtgmodels

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// BotUserCollection holds name of a "table" to Telegram user data
	BotUserCollection = "TgBotUser" // TODO: Change value to "BotTgUser" (and move into DAL?)

	TgChatCollection = "TgChat" // TODO: Change value to "BotTgChat" (and move into DAL?)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TgBotUser added in v0.0.3

type TgBotUser interface {
	botsfwmodels.BotUserData
	TgBotUserBaseData() *TgBotUserBaseData
}

type TgBotUserBaseData added in v0.0.3

type TgBotUserBaseData struct {
	botsfwmodels.BotUserBaseData
}

TgBotUserBaseData is Telegram user DB TgChatData (without ID)

func (*TgBotUserBaseData) GetEmail added in v0.0.3

func (*TgBotUserBaseData) GetEmail() string

GetEmail returns empty string

func (*TgBotUserBaseData) GetNames added in v0.0.3

func (entity *TgBotUserBaseData) GetNames() person.NameFields

GetNames return user names

func (*TgBotUserBaseData) IsEmailConfirmed added in v0.0.3

func (entity *TgBotUserBaseData) IsEmailConfirmed() bool

IsEmailConfirmed returns false

func (*TgBotUserBaseData) Name added in v0.0.3

func (entity *TgBotUserBaseData) Name() string

Name returns full display name combined from (first+last, nick) name

func (*TgBotUserBaseData) TgBotUserBaseData added in v0.0.3

func (entity *TgBotUserBaseData) TgBotUserBaseData() *TgBotUserBaseData

type TgChatBaseData added in v0.0.4

type TgChatBaseData struct {
	botsfwmodels.ChatBaseData

	// UserGroupID TODO: needs documentation what is it and intended usage
	UserGroupID string `datastore:",index,omitempty" firestore:",omitempty" dalgo:",index,omitempty"` // Do index

	// TelegramUserID is ID of user in Telegram. It is not ID of user in our app.
	// Deprecated: use botsfwmodels.ChatBaseData.BotUserID instead
	TelegramUserID int64 `datastore:",noindex,omitempty" firestore:",omitempty"`

	// TelegramUserIDs is a list of IDs of users in Telegram. It is not ID of user in our app.
	// Deprecated: use botsfwmodels.ChatBaseData.BotUserIDs instead
	TelegramUserIDs []int64 `datastore:",noindex"` // For groups

	LastProcessedUpdateID int `datastore:",noindex,omitempty" firestore:",omitempty"`

	TgChatInstanceID string // !DO index! // TODO: document what is chat instance and why we need to keep id of it
}

TgChatBaseData holds base properties of Telegram chat TgChatData

func NewTelegramChatBaseData added in v0.0.3

func NewTelegramChatBaseData() *TgChatBaseData

NewTelegramChatBaseData create new telegram chat TgChatData

func (*TgChatBaseData) Base added in v0.0.4

func (*TgChatBaseData) BaseTgChatData added in v0.0.4

func (data *TgChatBaseData) BaseTgChatData() *TgChatBaseData

func (*TgChatBaseData) ChatKey added in v0.0.4

func (data *TgChatBaseData) ChatKey() botsfwmodels.ChatKey

func (*TgChatBaseData) GetPreferredLanguage added in v0.0.4

func (data *TgChatBaseData) GetPreferredLanguage() string

GetPreferredLanguage returns preferred language for the chat

func (*TgChatBaseData) GetTgChatInstanceID added in v0.0.4

func (data *TgChatBaseData) GetTgChatInstanceID() string

GetTgChatInstanceID is what it is

func (*TgChatBaseData) SetAppUserID added in v0.0.4

func (data *TgChatBaseData) SetAppUserID(appUserID string)

SetAppUserID sets app user int ID

func (*TgChatBaseData) SetBotUserID added in v0.0.4

func (data *TgChatBaseData) SetBotUserID(id interface{})

SetBotUserID sets bot user int ID

func (*TgChatBaseData) SetTgChatInstanceID added in v0.0.4

func (data *TgChatBaseData) SetTgChatInstanceID(v string)

SetTgChatInstanceID is what it is

type TgChatData

type TgChatData interface {

	// BaseTgChatData returns a base struct that should be included in all structs that implement TgChatData.
	BaseTgChatData() *TgChatBaseData

	GetTgChatInstanceID() string

	SetTgChatInstanceID(v string)

	GetPreferredLanguage() string

	SetPreferredLanguage(code string)
}

TgChatData must be implemented by a data struct that stores chat data related to specific app/bot.

type TgChatInstanceBaseData

type TgChatInstanceBaseData struct {
	TgChatID          int64  `dalgo:",noindex" datastore:",noindex"`
	PreferredLanguage string `dalgo:",noindex" datastore:",noindex"`
}

TgChatInstanceBaseData is base struct for storing data related to a Telegram chat instance

func (*TgChatInstanceBaseData) GetPreferredLanguage

func (v *TgChatInstanceBaseData) GetPreferredLanguage() string

GetPreferredLanguage returns preferred language for the chat

func (*TgChatInstanceBaseData) GetTgChatID

func (v *TgChatInstanceBaseData) GetTgChatID() int64

GetTgChatID returns Telegram chat ID

func (*TgChatInstanceBaseData) SetPreferredLanguage

func (v *TgChatInstanceBaseData) SetPreferredLanguage(code string)

SetPreferredLanguage sets preferred language for the chat

func (*TgChatInstanceBaseData) Validate

func (v *TgChatInstanceBaseData) Validate() error

type TgChatInstanceData

type TgChatInstanceData interface {
	Validate() error
	GetTgChatID() int64
	GetPreferredLanguage() string
	SetPreferredLanguage(v string)
}

TgChatInstanceData describes chat instance TgChatData interface

Jump to

Keyboard shortcuts

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