bot

package
v0.0.0-...-1cee8e5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppBot

type AppBot interface {
	Start(ctx context.Context) error
	Run()
	Stop()
}

func NewBot

func NewBot(options ...Option) AppBot

type Bot

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

func (*Bot) Run

func (b *Bot) Run()

func (*Bot) Start

func (b *Bot) Start(context.Context) error

func (*Bot) Stop

func (b *Bot) Stop()

type Option

type Option func(b *Bot)

func WithConfig

func WithConfig(cfg config.AppConfig) Option

func WithQueue

func WithQueue(q pubsub.Queue) Option

func WithTelegramBot

func WithTelegramBot(tb TelegramBot) Option

func WithTwitterClient

func WithTwitterClient(tc TwitterClient) Option

type TelegramBot

type TelegramBot interface {
	Start()
	Stop()
	SetCommands([]TelegramBotCommand) error
	Handle(string, TelegramHandler)
	Send(string, interface{}, ...interface{}) error
	GetFile(string) (io.ReadCloser, error)
}

type TelegramBotCommand

type TelegramBotCommand struct {
	Text        string
	Description string
	IsAdmin     bool
}

type TelegramHandler

type TelegramHandler func(TelegramMessage) error

type TelegramMessage

type TelegramMessage struct {
	SenderID  string
	Text      string
	Payload   string
	Photo     TelegramPhoto
	IsPrivate bool
}

type TelegramPhoto

type TelegramPhoto struct {
	Caption  string
	FileID   string
	FileURL  string
	FileSize int64
}

type TwitterClient

type TwitterClient interface {
	SendUpdate(string) error
	SendUpdateWithPhoto(string, []byte) error
}

Jump to

Keyboard shortcuts

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