app

package
v0.0.0-...-d6d0f5f Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp() *App

func (*App) Start

func (a *App) Start()

type Authorization

type Authorization struct {
	// contains filtered or unexported fields
}

func NewAuthorization

func NewAuthorization(source *DataSource) *Authorization

func (*Authorization) CheckAuthorization

func (a *Authorization) CheckAuthorization(userMessage *Message) bool

func (*Authorization) TryAuthorize

func (a *Authorization) TryAuthorize(msg *Message) bool

type Command

type Command struct {
	ID      int
	Command string
	Text    string
	Buttons []string
}

type DataSource

type DataSource struct {
	// contains filtered or unexported fields
}

func NewDataSource

func NewDataSource(path string) (*DataSource, error)

func (DataSource) FindCommand

func (ds DataSource) FindCommand(cmdText string) *Command

func (DataSource) FindUserByFirstNameAndLatName

func (ds DataSource) FindUserByFirstNameAndLatName(firstName string, lastName string) *UserDB

func (DataSource) FindUserByTelegramId

func (ds DataSource) FindUserByTelegramId(TelegramID int) *UserDB

func (DataSource) SetTelegramIdToUser

func (ds DataSource) SetTelegramIdToUser(user *UserDB, telegramId int) bool

type Message

type Message struct {
	CharID     int64
	TelegramID int
	UserName   string
	Text       string
}

type MessageTemplate

type MessageTemplate struct {
	Start                   string `json:"start"`
	NotAuthorized           string `json:"not_authorized"`
	SuccessfulAuthorization string `json:"successful_authorization"`
	MainCommand             string `json:"main_command"`
	UndefinedCommand        string `json:"undefined_command"`
}

type UI

type UI struct {
	// contains filtered or unexported fields
}

func NewUI

func NewUI(dataSource *DataSource) *UI

func (UI) HandleMessage

func (u UI) HandleMessage(userMessage *Message) *tgbotapi.MessageConfig

type UserDB

type UserDB struct {
	ID         int
	FirstName  string
	LastName   string
	TelegramID sql.NullInt64
}

Jump to

Keyboard shortcuts

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