sender

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChats    = apperrors.Business("no chats to send message", "SENDER:NO_CHATS")
	ErrFailToSend = apperrors.System(nil, "fail to send message", "SENDER:FAIL_TO_SEND")
)

Functions

func BuildCleanupMessage

func BuildCleanupMessage(count int64) string

func BuildMessage

func BuildMessage(entry model.IEntry) string

func BuildMsgFooter

func BuildMsgFooter() string

func BuildMsgHeader

func BuildMsgHeader() string

func CalculeSendInterval

func CalculeSendInterval(count int) time.Duration

Types

type Resume

type Resume struct {
	Loaded   int
	Filtered int
	Sources  []ResumeSource
}

func (Resume) HTML

func (r Resume) HTML() string

type ResumeSource

type ResumeSource struct {
	Source   string
	Loaded   int
	Filtered int
}

func (ResumeSource) HTML

func (r ResumeSource) HTML() string

type SendCleanupNotifyOptions

type SendCleanupNotifyOptions struct {
	Count int64
}

type SendFileOptions

type SendFileOptions struct {
	FilePath string
	Caption  string
}

type SendResumeOptions

type SendResumeOptions struct {
	Resume Resume
	Chats  []int64
}

type Serder

type Serder[T model.IEntry] interface {
	Send(ctx context.Context, entry T) error
	SendCollection(ctx context.Context, entry []T) error
	SendResume(ctx context.Context, opt SendResumeOptions) error
	SendCleanupNotify(ctx context.Context, opt SendCleanupNotifyOptions) error
	SendFile(ctx context.Context, opt SendFileOptions) error
	SendStory(ctx context.Context, story Story[T]) error
	WithChats(ids []int64) Serder[T]
}

type Story

type Story[T model.IEntry] struct {
	Story stories.Story
	Entry T
}

type TelegramOptions

type TelegramOptions[T model.IEntry] struct {
	Chats   []int64
	Storage storage.Storage[T]
}

type TelegramSerder

type TelegramSerder[T model.IEntry] struct {
	// contains filtered or unexported fields
}

func NewTelegramSerder

func NewTelegramSerder[T model.IEntry](bot *telebot.Bot, opts TelegramOptions[T]) TelegramSerder[T]

func (TelegramSerder[T]) Send

func (s TelegramSerder[T]) Send(ctx context.Context, entry T) error

func (TelegramSerder[T]) SendCleanupNotify

func (s TelegramSerder[T]) SendCleanupNotify(ctx context.Context, opt SendCleanupNotifyOptions) error

func (TelegramSerder[T]) SendCollection

func (s TelegramSerder[T]) SendCollection(ctx context.Context, entries []T) error

func (TelegramSerder[T]) SendFile

func (s TelegramSerder[T]) SendFile(ctx context.Context, opt SendFileOptions) error

func (TelegramSerder[T]) SendResume

func (s TelegramSerder[T]) SendResume(ctx context.Context, opt SendResumeOptions) error

func (TelegramSerder[T]) SendStory

func (s TelegramSerder[T]) SendStory(ctx context.Context, story Story[T]) error

func (TelegramSerder[T]) WithChats

func (s TelegramSerder[T]) WithChats(ids []int64) Serder[T]

WithChats add chats to send messages.

Jump to

Keyboard shortcuts

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