telegram

package
v0.0.0-...-8c259ab Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package telegram is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InlineOption

type InlineOption struct {
	// human-readable text of inline element
	Description string
	// payload of inline element sent back into TgInteraction.InlineSelectionData
	SelectionData string
}

type MissingCommandError

type MissingCommandError struct{ Command string }

func (MissingCommandError) Error

func (e MissingCommandError) Error() string

type MockTelegoBotApi

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

MockTelegoBotApi is a mock of TelegoBotApi interface.

func NewMockTelegoBotApi

func NewMockTelegoBotApi(ctrl *gomock.Controller) *MockTelegoBotApi

NewMockTelegoBotApi creates a new mock instance.

func (*MockTelegoBotApi) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTelegoBotApi) SendMessage

func (m *MockTelegoBotApi) SendMessage(params *telego.SendMessageParams) (*telego.Message, error)

SendMessage mocks base method.

func (*MockTelegoBotApi) StopLongPolling

func (m *MockTelegoBotApi) StopLongPolling()

StopLongPolling mocks base method.

func (*MockTelegoBotApi) UpdatesViaLongPolling

func (m *MockTelegoBotApi) UpdatesViaLongPolling(params *telego.GetUpdatesParams, options ...telego.LongPollingOption) (<-chan telego.Update, error)

UpdatesViaLongPolling mocks base method.

type MockTelegoBotApiMockRecorder

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

MockTelegoBotApiMockRecorder is the mock recorder for MockTelegoBotApi.

func (*MockTelegoBotApiMockRecorder) SendMessage

func (mr *MockTelegoBotApiMockRecorder) SendMessage(params any) *gomock.Call

SendMessage indicates an expected call of SendMessage.

func (*MockTelegoBotApiMockRecorder) StopLongPolling

func (mr *MockTelegoBotApiMockRecorder) StopLongPolling() *gomock.Call

StopLongPolling indicates an expected call of StopLongPolling.

func (*MockTelegoBotApiMockRecorder) UpdatesViaLongPolling

func (mr *MockTelegoBotApiMockRecorder) UpdatesViaLongPolling(params any, options ...any) *gomock.Call

UpdatesViaLongPolling indicates an expected call of UpdatesViaLongPolling.

type TelegoBotApi

type TelegoBotApi interface {
	UpdatesViaLongPolling(params *telego.GetUpdatesParams, options ...telego.LongPollingOption) (<-chan telego.Update, error)
	StopLongPolling()
	SendMessage(params *telego.SendMessageParams) (*telego.Message, error)
}

type TgBotResponse

type TgBotResponse struct {
	// bot text response, if any
	ResponseText string
	// inline response options, if any
	InlineOptions []InlineOption
}

represents adapter for relevant data to create telego.SendMessageParams from bot

func (TgBotResponse) IsInline

func (tgbr TgBotResponse) IsInline() bool

type TgClient

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

func NewTgClient

func NewTgClient(token string, cmdHandlers map[string]TgUpdateHandler) (*TgClient, error)

func (*TgClient) OpenUpdatesChannel

func (tgClient *TgClient) OpenUpdatesChannel() (<-chan telego.Update, error)

func (*TgClient) ProcessUpdate

func (tgClient *TgClient) ProcessUpdate(update telego.Update) error

func (*TgClient) StopUpdates

func (tgClient *TgClient) StopUpdates()

type TgInteraction

type TgInteraction struct {
	// raw text of the received update
	RawText string
	// parsed command in the update (without leading /)
	Cmd string
	// args passed with command, if any
	CmdArgs []string
	// inline selection data
	InlineSelectionData string
	// message that triggered the inline selection prompt
	InlineSelectionTrigger string
}

represents adapter for relevant data of telego.Update

func (TgInteraction) IsCommand

func (tgi TgInteraction) IsCommand() bool

func (TgInteraction) IsInline

func (tgi TgInteraction) IsInline() bool

type TgUpdateHandler

type TgUpdateHandler func(tgUpdate telego.Update) (string, error)

type UnprocessableMessageError

type UnprocessableMessageError struct{}

func (UnprocessableMessageError) Error

Jump to

Keyboard shortcuts

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