model

package
v0.0.0-...-eb4b608 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists = errors.New("record already exists")
	ErrNotFound      = errors.New("record not found")
)
View Source
var ErrAddressNotFound = errors.New("address not found")
View Source
var ErrHomeAddressNotSet = errors.New("home address not set")

Functions

This section is empty.

Types

type AFKData

type AFKData struct {
	Since     time.Time      `db:"afk_since"`
	Reason    sql.NullString `db:"afk_reason"`
	FirstName string         `db:"first_name"`
}

func (*AFKData) Duration

func (a *AFKData) Duration() time.Duration

type AllowService

type AllowService interface {
	AllowChat(chat *telebot.Chat) error
	AllowUser(user *telebot.User) error
	DenyChat(chat *telebot.Chat) error
	DenyUser(user *telebot.User) error
	IsChatAllowed(chat *telebot.Chat) bool
	IsUserAllowed(user *telebot.User) bool
}

type ChatService

type ChatService interface {
	Allow(chat *telebot.Chat) error
	Create(chat *telebot.Chat) error
	CreateTx(tx *sqlx.Tx, chat *telebot.Chat) error
	Deny(chat *telebot.Chat) error
	GetAllAllowed() ([]int64, error)
}

type ChatsPluginsService

type ChatsPluginsService interface {
	Disable(chat *telebot.Chat, pluginName string) error
	Enable(chat *telebot.Chat, pluginName string) error
	GetAllDisabled() (map[int64][]string, error)
}

type ChatsUsersService

type ChatsUsersService interface {
	Create(chat *telebot.Chat, user *telebot.User) error
	CreateBatch(chat *telebot.Chat, users *[]telebot.User) error
	GetAllUsersWithMsgCount(chat *telebot.Chat) ([]User, error)
	IsAllowed(chat *telebot.Chat, user *telebot.User) bool
	Leave(chat *telebot.Chat, user *telebot.User) error
}

type Credential

type Credential struct {
	Name  string `db:"name"`
	Value string `db:"value"`
}

type CredentialService

type CredentialService interface {
	GetAllCredentials() ([]Credential, error)
	GetKey(name string) (string, error)
	SetKey(name, value string) error
	DeleteKey(name string) error
}

type GeocodingService

type GeocodingService interface {
	Geocode(address string) (telebot.Venue, error)
}

type GoogleImages

type GoogleImages struct {
	QueryID      int64
	CurrentIndex int
	Images       []Image
}

type HomeService

type HomeService interface {
	GetHome(user *telebot.User) (telebot.Venue, error)
	SetHome(user *telebot.User, venue *telebot.Venue) error
	DeleteHome(user *telebot.User) error
}

type Image

type Image interface {
	ImageLink() string
	ContextLink() string
	IsGIF() bool
}

type ManagerService

type ManagerService interface {
	Plugins() []plugin.Plugin
	EnablePlugin(name string) error
	EnablePluginForChat(chat *telebot.Chat, name string) error
	DisablePlugin(name string) error
	DisablePluginForChat(chat *telebot.Chat, name string) error
	IsPluginEnabled(name string) bool
	IsPluginDisabledForChat(chat *telebot.Chat, name string) bool
}

type Plugin

type Plugin struct {
	Name    string `db:"name"`
	Enabled bool   `db:"enabled"`
}

type PluginService

type PluginService interface {
	CreateTx(tx *sqlx.Tx, pluginName string) error
	Disable(pluginName string) error
	Enable(pluginName string) error
	GetAllEnabled() ([]string, error)
}

type Reminder

type Reminder struct {
	ID       int64         `db:"id"`
	ChatID   sql.NullInt64 `db:"chat_id"`
	UserID   int64         `db:"user_id"`
	Username string        `db:"username"`
	Time     time.Time     `db:"time"`
	Text     string        `db:"text"`
}

type User

type User struct {
	ID        int64          `db:"id"`
	FirstName string         `db:"first_name"`
	LastName  sql.NullString `db:"last_name"`
	Username  sql.NullString `db:"username"`
	Allowed   bool           `db:"allowed"`
	MsgCount  int64          `db:"msg_count"`
	InGroup   bool           `db:"in_group"`
	Birthday  sql.NullTime   `db:"birthday"`
}

func (*User) GetFullName

func (user *User) GetFullName() string

type UserService

type UserService interface {
	Allow(user *telebot.User) error
	Create(user *telebot.User) error
	CreateTx(tx *sqlx.Tx, user *telebot.User) error
	Deny(user *telebot.User) error
	GetAllAllowed() ([]int64, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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