Documentation
¶
Index ¶
- Constants
- Variables
- func SerializeIntoMessage(object any, outputLanguage s.Language) (string, error)
- type BotWithMetrics
- type BuildingButton
- type Button
- type ButtonHandler
- type CommandHandler
- type HandlerContainer
- func (h HandlerContainer) GetButtonHandler(buttonName string) (ButtonHandler, bool)
- func (h HandlerContainer) GetCommandHandler(command string) (func(c.Context, *tgbotapi.Message) error, bool)
- func (h HandlerContainer) ProcessCommonMessage(ctx c.Context, message *tgbotapi.Message) error
- func (h HandlerContainer) SendMessage(ctx c.Context, chatId int64, msgText string, parseMode string) error
- type InternalBot
- type InternalBot_mock
- func (_m *InternalBot_mock) EXPECT() *InternalBot_mock_Expecter
- func (_m *InternalBot_mock) GetUpdatesChan(_a0 tgbotapi.UpdateConfig) tgbotapi.UpdatesChannel
- func (_m *InternalBot_mock) Request(_a0 tgbotapi.Chattable) (*tgbotapi.APIResponse, error)
- func (_m *InternalBot_mock) Send(_a0 tgbotapi.Chattable) (tgbotapi.Message, error)
- type InternalBot_mock_Expecter
- type InternalBot_mock_GetUpdatesChan_Call
- func (_c *InternalBot_mock_GetUpdatesChan_Call) Return(_a0 tgbotapi.UpdatesChannel) *InternalBot_mock_GetUpdatesChan_Call
- func (_c *InternalBot_mock_GetUpdatesChan_Call) Run(run func(_a0 tgbotapi.UpdateConfig)) *InternalBot_mock_GetUpdatesChan_Call
- func (_c *InternalBot_mock_GetUpdatesChan_Call) RunAndReturn(run func(tgbotapi.UpdateConfig) tgbotapi.UpdatesChannel) *InternalBot_mock_GetUpdatesChan_Call
- type InternalBot_mock_Request_Call
- func (_c *InternalBot_mock_Request_Call) Return(_a0 *tgbotapi.APIResponse, _a1 error) *InternalBot_mock_Request_Call
- func (_c *InternalBot_mock_Request_Call) Run(run func(_a0 tgbotapi.Chattable)) *InternalBot_mock_Request_Call
- func (_c *InternalBot_mock_Request_Call) RunAndReturn(run func(tgbotapi.Chattable) (*tgbotapi.APIResponse, error)) *InternalBot_mock_Request_Call
- type InternalBot_mock_Send_Call
- func (_c *InternalBot_mock_Send_Call) Return(_a0 tgbotapi.Message, _a1 error) *InternalBot_mock_Send_Call
- func (_c *InternalBot_mock_Send_Call) Run(run func(_a0 tgbotapi.Chattable)) *InternalBot_mock_Send_Call
- func (_c *InternalBot_mock_Send_Call) RunAndReturn(run func(tgbotapi.Chattable) (tgbotapi.Message, error)) *InternalBot_mock_Send_Call
- type LanguageButton
- type NextButton
Constants ¶
const ( BUILDING_BUTTON = "building" NEXT_BUTTON = "next" LANGUAGE_BUTTON = "language" MAX_MESSAGE_LENGTH = 50 )
const (
DEFAULT_DISTANCE = 100
)
Variables ¶
var ( ErrNoChat = errors.New("a message contains no chat") ErrNoLocation = errors.New("a message contains no location") ErrUnexpectedCallback = errors.New("a callback contains unexpected info") )
var ErrNoFieldTag error = errors.New("no expected field tag")
var ErrNoNameTag error = errors.New("no name tag")
var ErrUnexpectedFieldType error = errors.New("unexpected field type")
var ErrUnexpectedType error = errors.New("unexpected input type")
Functions ¶
Types ¶
type BotWithMetrics ¶ added in v0.1.0
func NewBotWithMetrics ¶ added in v0.1.0
func NewBotWithMetrics(bot *tgbotapi.BotAPI, m *metrics.Metrics) *BotWithMetrics
func (*BotWithMetrics) Request ¶ added in v0.1.0
func (b *BotWithMetrics) Request(c tgbotapi.Chattable) (*tgbotapi.APIResponse, error)
type BuildingButton ¶ added in v1.0.0
type Button ¶
type Button struct {
Name string `json:"name"`
// contains filtered or unexported fields
}
type ButtonHandler ¶
type ButtonHandler func(c.Context, *tgbotapi.CallbackQuery) error
type CommandHandler ¶
type HandlerContainer ¶
type HandlerContainer struct {
HandlersPerCommand map[string]CommandHandler
// contains filtered or unexported fields
}
func NewCommandContainer ¶
func NewCommandContainer( bot InternalBot, service services.BuildingService, userService services.UserService, metricsContainer *metrics.Metrics, ) HandlerContainer
func (HandlerContainer) GetButtonHandler ¶
func (h HandlerContainer) GetButtonHandler(buttonName string) (ButtonHandler, bool)
func (HandlerContainer) GetCommandHandler ¶ added in v0.1.0
func (HandlerContainer) ProcessCommonMessage ¶ added in v1.0.0
func (HandlerContainer) SendMessage ¶
type InternalBot ¶ added in v0.1.0
type InternalBot interface {
Request(tgbotapi.Chattable) (*tgbotapi.APIResponse, error)
Send(tgbotapi.Chattable) (tgbotapi.Message, error)
GetUpdatesChan(tgbotapi.UpdateConfig) tgbotapi.UpdatesChannel
}
type InternalBot_mock ¶ added in v0.1.0
InternalBot_mock is an autogenerated mock type for the InternalBot type
func NewInternalBot_mock ¶ added in v0.1.0
func NewInternalBot_mock(t interface {
mock.TestingT
Cleanup(func())
}) *InternalBot_mock
NewInternalBot_mock creates a new instance of InternalBot_mock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*InternalBot_mock) EXPECT ¶ added in v0.1.0
func (_m *InternalBot_mock) EXPECT() *InternalBot_mock_Expecter
func (*InternalBot_mock) GetUpdatesChan ¶ added in v0.1.0
func (_m *InternalBot_mock) GetUpdatesChan(_a0 tgbotapi.UpdateConfig) tgbotapi.UpdatesChannel
GetUpdatesChan provides a mock function with given fields: _a0
func (*InternalBot_mock) Request ¶ added in v0.1.0
func (_m *InternalBot_mock) Request(_a0 tgbotapi.Chattable) (*tgbotapi.APIResponse, error)
Request provides a mock function with given fields: _a0
type InternalBot_mock_Expecter ¶ added in v0.1.0
type InternalBot_mock_Expecter struct {
// contains filtered or unexported fields
}
func (*InternalBot_mock_Expecter) GetUpdatesChan ¶ added in v0.1.0
func (_e *InternalBot_mock_Expecter) GetUpdatesChan(_a0 interface{}) *InternalBot_mock_GetUpdatesChan_Call
GetUpdatesChan is a helper method to define mock.On call
- _a0 tgbotapi.UpdateConfig
func (*InternalBot_mock_Expecter) Request ¶ added in v0.1.0
func (_e *InternalBot_mock_Expecter) Request(_a0 interface{}) *InternalBot_mock_Request_Call
Request is a helper method to define mock.On call
- _a0 tgbotapi.Chattable
func (*InternalBot_mock_Expecter) Send ¶ added in v0.1.0
func (_e *InternalBot_mock_Expecter) Send(_a0 interface{}) *InternalBot_mock_Send_Call
Send is a helper method to define mock.On call
- _a0 tgbotapi.Chattable
type InternalBot_mock_GetUpdatesChan_Call ¶ added in v0.1.0
InternalBot_mock_GetUpdatesChan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUpdatesChan'
func (*InternalBot_mock_GetUpdatesChan_Call) Return ¶ added in v0.1.0
func (_c *InternalBot_mock_GetUpdatesChan_Call) Return(_a0 tgbotapi.UpdatesChannel) *InternalBot_mock_GetUpdatesChan_Call
func (*InternalBot_mock_GetUpdatesChan_Call) Run ¶ added in v0.1.0
func (_c *InternalBot_mock_GetUpdatesChan_Call) Run(run func(_a0 tgbotapi.UpdateConfig)) *InternalBot_mock_GetUpdatesChan_Call
func (*InternalBot_mock_GetUpdatesChan_Call) RunAndReturn ¶ added in v0.1.0
func (_c *InternalBot_mock_GetUpdatesChan_Call) RunAndReturn(run func(tgbotapi.UpdateConfig) tgbotapi.UpdatesChannel) *InternalBot_mock_GetUpdatesChan_Call
type InternalBot_mock_Request_Call ¶ added in v0.1.0
InternalBot_mock_Request_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Request'
func (*InternalBot_mock_Request_Call) Return ¶ added in v0.1.0
func (_c *InternalBot_mock_Request_Call) Return(_a0 *tgbotapi.APIResponse, _a1 error) *InternalBot_mock_Request_Call
func (*InternalBot_mock_Request_Call) Run ¶ added in v0.1.0
func (_c *InternalBot_mock_Request_Call) Run(run func(_a0 tgbotapi.Chattable)) *InternalBot_mock_Request_Call
func (*InternalBot_mock_Request_Call) RunAndReturn ¶ added in v0.1.0
func (_c *InternalBot_mock_Request_Call) RunAndReturn(run func(tgbotapi.Chattable) (*tgbotapi.APIResponse, error)) *InternalBot_mock_Request_Call
type InternalBot_mock_Send_Call ¶ added in v0.1.0
InternalBot_mock_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send'
func (*InternalBot_mock_Send_Call) Return ¶ added in v0.1.0
func (_c *InternalBot_mock_Send_Call) Return(_a0 tgbotapi.Message, _a1 error) *InternalBot_mock_Send_Call
func (*InternalBot_mock_Send_Call) Run ¶ added in v0.1.0
func (_c *InternalBot_mock_Send_Call) Run(run func(_a0 tgbotapi.Chattable)) *InternalBot_mock_Send_Call
func (*InternalBot_mock_Send_Call) RunAndReturn ¶ added in v0.1.0
func (_c *InternalBot_mock_Send_Call) RunAndReturn(run func(tgbotapi.Chattable) (tgbotapi.Message, error)) *InternalBot_mock_Send_Call