botsfwtgmodels

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// BotUserCollection holds name of a "table" to Telegram user data
	BotUserCollection = "TgPlatformUser" // 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 TgChatBaseData added in v0.0.4

type TgChatBaseData struct {
	botsfwmodels.ChatBaseData

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

	LastProcessedUpdateID int `firestore:"lastProcessedUpdateID,omitempty"`

	TgChatInstanceID string `firestore:"tgChatInstanceID,omitempty"` // !DO index! TODO: document why needed
}

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) 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

type TgPlatformUser added in v0.3.0

type TgPlatformUser interface {
	botsfwmodels.PlatformUserData
	TgPlatformUserBaseDbo() *TgPlatformUserBaseDbo
}

type TgPlatformUserBaseDbo added in v0.3.0

type TgPlatformUserBaseDbo struct {
	botsfwmodels.PlatformUserBaseDbo
}

TgPlatformUserBaseDbo is Telegram user DB TgChatData (without ID)

func (*TgPlatformUserBaseDbo) GetEmail added in v0.3.0

func (*TgPlatformUserBaseDbo) GetEmail() string

GetEmail returns empty string

func (*TgPlatformUserBaseDbo) GetNames added in v0.3.0

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

GetNames return user names

func (*TgPlatformUserBaseDbo) IsEmailConfirmed added in v0.3.0

func (entity *TgPlatformUserBaseDbo) IsEmailConfirmed() bool

IsEmailConfirmed returns false

func (*TgPlatformUserBaseDbo) Name added in v0.3.0

func (entity *TgPlatformUserBaseDbo) Name() string

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

func (*TgPlatformUserBaseDbo) TgPlatformUserBaseDbo added in v0.3.0

func (entity *TgPlatformUserBaseDbo) TgPlatformUserBaseDbo() *TgPlatformUserBaseDbo

Jump to

Keyboard shortcuts

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