telegram

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotHandler

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

func NewBotHandler

func NewBotHandler(l *logger.Logger, tgBot TgBot, svc Service) *BotHandler

func (*BotHandler) HandleUpdate

func (h *BotHandler) HandleUpdate(ctx context.Context, update tgbotapi.Update)

HandleUpdate processes incoming updates from Telegram.

func (*BotHandler) Start

func (h *BotHandler) Start(ctx context.Context) error

Start begins processing updates from Telegram.

type MessageWithButtonsParams added in v1.0.11

type MessageWithButtonsParams struct {
	ChatID         int64
	Text           string
	ActionsButtons []tgbotapi.InlineKeyboardButton
	Buttons        []tgbotapi.InlineKeyboardButton
	ButtonsPerRow  int
	IsNeedEditMsg  bool
}

type Service

type Service interface {
	RemoveAllSubscriptionsByUserID(ctx context.Context, userID int64) error
	RemoveSubscriptionByID(ctx context.Context, id string) error
	CreateSubscription(ctx context.Context, subscription ds.SubscriptionRequest) (ds.SubscriptionResponse, error)
	GetAllSubscriptionsByUserID(ctx context.Context, userID int64) ([]ds.SubscriptionResponse, error)
	UpsertUser(ctx context.Context, user ds.UserRequest) (ds.UserResponse, error)

	GetCarBrandsList() []string
	GetCarModelsList(brand string) ([]string, bool)
	GetCarChassisList() map[string]string
	GetRegionsList() map[string]string
}

type SubscribeState

type SubscribeState struct {
	Step            subscribeStep
	InProgress      bool
	SelectedBrand   string
	SelectedModels  []string
	SelectedChassis []string
	SelectedRegions []string
	PriceFrom       string
	PriceTo         string
	YearFrom        string
	YearTo          string
	LastMessageID   int
}

type TgBot

type TgBot interface {
	GetAPI() *tgbotapi.BotAPI
	GetCfg() *telegram.Config
	SendMessage(c tgbotapi.Chattable) (tgbotapi.Message, error)
	SetCommands(commands []tgbotapi.BotCommand) error
}

Jump to

Keyboard shortcuts

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