Documentation ¶
Index ¶
- Constants
- Variables
- func BaseTgChatDtoMaker(botID string) (botChat botsfwmodels.BotChatData, err error)
- func BaseTgUserDtoMaker(botID string) (botsfwmodels.PlatformUserData, error)
- func EditMessageOnCallbackQuery(whcbq botinput.WebhookCallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
- func NewBotRecordsFieldsSetter(...) botsfw.BotRecordsFieldsSetter
- func NewTelegramBot(environment string, profile botsfw.BotProfile, ...) botsfw.BotSettings
- func NewTelegramWebhookHandler(botContextProvider botsfw.BotContextProvider, ...) botsfw.WebhookHandler
- func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (botinput.WebhookInput, error)
- type CallbackAnswer
- type ChatMessageUID
- type DataStore
- type ExportChatInviteLink
- type InlineBotMessage
- type InlineMessageUID
- type LeaveChat
- type TgChatInstanceDal
- type TgMessageType
- type TgWebhookCallbackQuery
- func (twhcbq TgWebhookCallbackQuery) BotChatID() (string, error)
- func (whi TgWebhookCallbackQuery) Chat() botinput.WebhookChat
- func (twhcbq TgWebhookCallbackQuery) GetData() string
- func (twhcbq TgWebhookCallbackQuery) GetFrom() botinput.WebhookSender
- func (twhcbq TgWebhookCallbackQuery) GetID() string
- func (twhcbq TgWebhookCallbackQuery) GetInlineMessageID() string
- func (twhcbq TgWebhookCallbackQuery) GetMessage() botinput.WebhookMessage
- func (whi TgWebhookCallbackQuery) GetRecipient() botinput.WebhookRecipient
- func (whi TgWebhookCallbackQuery) GetSender() botinput.WebhookUser
- func (whi TgWebhookCallbackQuery) GetTime() time.Time
- func (twhcbq TgWebhookCallbackQuery) InputType() botinput.WebhookInputType
- func (whi TgWebhookCallbackQuery) LogRequest()
- func (twhcbq TgWebhookCallbackQuery) Sequence() int
- func (whi TgWebhookCallbackQuery) StringID() string
- func (twhcbq TgWebhookCallbackQuery) TelegramCallbackMessage() *tgbotapi.Message
- func (whi TgWebhookCallbackQuery) TelegramChatID() int64
- func (whi TgWebhookCallbackQuery) TgUpdate() *tgbotapi.Update
- type TgWebhookChat
- type TgWebhookInlineQuery
- func (iq TgWebhookInlineQuery) BotChatID() (string, error)
- func (whi TgWebhookInlineQuery) Chat() botinput.WebhookChat
- func (iq TgWebhookInlineQuery) GetFrom() botinput.WebhookSender
- func (whi TgWebhookInlineQuery) GetID() interface{}
- func (iq TgWebhookInlineQuery) GetInlineQueryID() string
- func (iq TgWebhookInlineQuery) GetOffset() string
- func (iq TgWebhookInlineQuery) GetQuery() string
- func (whi TgWebhookInlineQuery) GetRecipient() botinput.WebhookRecipient
- func (whi TgWebhookInlineQuery) GetSender() botinput.WebhookUser
- func (whi TgWebhookInlineQuery) GetTime() time.Time
- func (TgWebhookInlineQuery) InputType() botinput.WebhookInputType
- func (whi TgWebhookInlineQuery) LogRequest()
- func (whi TgWebhookInlineQuery) StringID() string
- func (whi TgWebhookInlineQuery) TelegramChatID() int64
- func (whi TgWebhookInlineQuery) TgUpdate() *tgbotapi.Update
- type TgWebhookInput
Constants ¶
const ( // TgMessageTypeRegular is 'message' TgMessageTypeRegular = "message" // TgMessageTypeEdited is 'edited_message' TgMessageTypeEdited = "edited_message" // TgMessageTypeChannelPost is 'channel_post' TgMessageTypeChannelPost = "channel_post" // TgMessageTypeEditedChannelPost is 'edited_channel_post' TgMessageTypeEditedChannelPost = "edited_channel_post" )
const PlatformID = "telegram"
PlatformID is 'telegram'
Variables ¶
var CallbackCurrent botsfw.MessageUID = &callbackCurrent{}
CallbackCurrent is what?
var Platform botsfw.BotPlatform = platform{}
Platform is a bots platform descriptor (in this case - for Telegram)
Functions ¶
func BaseTgChatDtoMaker ¶ added in v0.6.0
func BaseTgChatDtoMaker(botID string) (botChat botsfwmodels.BotChatData, err error)
func BaseTgUserDtoMaker ¶ added in v0.6.0
func BaseTgUserDtoMaker(botID string) (botsfwmodels.PlatformUserData, error)
func EditMessageOnCallbackQuery ¶
func EditMessageOnCallbackQuery(whcbq botinput.WebhookCallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
EditMessageOnCallbackQuery creates edit message
func NewBotRecordsFieldsSetter ¶ added in v0.6.0
func NewBotRecordsFieldsSetter( setAppUserFields func(appUser botsfwmodels.AppUserData, sender botinput.WebhookSender) error, ) botsfw.BotRecordsFieldsSetter
func NewTelegramBot ¶
func NewTelegramBot( environment string, profile botsfw.BotProfile, code, token, paymentTestToken, paymentToken, gaToken string, locale i18n.Locale, getDatabase botsfw.DbGetter, getAppUser botsfw.AppUserGetter, ) botsfw.BotSettings
NewTelegramBot creates definition of new telegram bot
func NewTelegramWebhookHandler ¶
func NewTelegramWebhookHandler( botContextProvider botsfw.BotContextProvider, translatorProvider botsfw.TranslatorProvider, setAppUserFields func(botsfwmodels.AppUserData, botinput.WebhookSender) error, ) botsfw.WebhookHandler
NewTelegramWebhookHandler creates new Telegram webhooks handler
func NewTelegramWebhookInput ¶
func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (botinput.WebhookInput, error)
NewTelegramWebhookInput maps telegram update struct to bots framework interface
Types ¶
type CallbackAnswer ¶
type CallbackAnswer tgbotapi.AnswerCallbackQueryConfig
CallbackAnswer is callback answer message
func (CallbackAnswer) BotMessageType ¶
func (CallbackAnswer) BotMessageType() botsfw.BotMessageType
BotMessageType returns BotMessageTypeCallbackAnswer
type ChatMessageUID ¶
ChatMessageUID is what?
func NewChatMessageUID ¶
func NewChatMessageUID(chatID int64, messageID int) *ChatMessageUID
NewChatMessageUID create new ChatMessageUID
func (ChatMessageUID) UID ¶
func (m ChatMessageUID) UID() string
UID return unique ID of the message
type DataStore ¶ added in v0.5.0
type DataStore interface { TgChatInstanceDal }
type ExportChatInviteLink ¶
type ExportChatInviteLink tgbotapi.ExportChatInviteLink
ExportChatInviteLink is TG message
func (ExportChatInviteLink) BotMessageType ¶
func (ExportChatInviteLink) BotMessageType() botsfw.BotMessageType
BotMessageType returns BotMessageTypeExportChatInviteLink
type InlineBotMessage ¶
type InlineBotMessage tgbotapi.InlineConfig
InlineBotMessage is wrapper for Telegram bot message
func (InlineBotMessage) BotMessageType ¶
func (InlineBotMessage) BotMessageType() botsfw.BotMessageType
BotMessageType returns BotMessageTypeInlineResults
type InlineMessageUID ¶
type InlineMessageUID struct {
InlineMessageID string
}
InlineMessageUID is inline message UID
func NewInlineMessageUID ¶
func NewInlineMessageUID(inlineMessageID string) *InlineMessageUID
NewInlineMessageUID creates new inline message UID
func (InlineMessageUID) UID ¶
func (m InlineMessageUID) UID() string
UID is unique ID of the message
type LeaveChat ¶
type LeaveChat tgbotapi.LeaveChatConfig
LeaveChat is leave chat message from bot
func (LeaveChat) BotMessageType ¶
func (LeaveChat) BotMessageType() botsfw.BotMessageType
BotMessageType return BotMessageTypeLeaveChat
type TgChatInstanceDal ¶
type TgChatInstanceDal interface { GetTelegramChatInstanceByID(c context.Context, id string) (tgChatInstance botsfwtgmodels.TgChatInstanceData, err error) NewTelegramChatInstance(chatInstanceID string, chatID int64, preferredLanguage string) (tgChatInstance botsfwtgmodels.TgChatInstanceData) SaveTelegramChatInstance(c context.Context, id string, tgChatInstance botsfwtgmodels.TgChatInstanceData) (err error) }
TgChatInstanceDal is Data Access Layer for telegram chat instance Data
type TgWebhookCallbackQuery ¶
type TgWebhookCallbackQuery struct {
// contains filtered or unexported fields
}
TgWebhookCallbackQuery is wrapper on callback query
func (TgWebhookCallbackQuery) BotChatID ¶
func (twhcbq TgWebhookCallbackQuery) BotChatID() (string, error)
BotChatID returns bot chat ID
func (TgWebhookCallbackQuery) Chat ¶
func (whi TgWebhookCallbackQuery) Chat() botinput.WebhookChat
func (TgWebhookCallbackQuery) GetData ¶
func (twhcbq TgWebhookCallbackQuery) GetData() string
GetData returns callback query data
func (TgWebhookCallbackQuery) GetFrom ¶
func (twhcbq TgWebhookCallbackQuery) GetFrom() botinput.WebhookSender
GetFrom returns sender
func (TgWebhookCallbackQuery) GetID ¶
func (twhcbq TgWebhookCallbackQuery) GetID() string
GetID returns update ID
func (TgWebhookCallbackQuery) GetInlineMessageID ¶
func (twhcbq TgWebhookCallbackQuery) GetInlineMessageID() string
GetInlineMessageID returns callback query inline message ID
func (TgWebhookCallbackQuery) GetMessage ¶
func (twhcbq TgWebhookCallbackQuery) GetMessage() botinput.WebhookMessage
GetMessage returns message
func (TgWebhookCallbackQuery) GetRecipient ¶
func (whi TgWebhookCallbackQuery) GetRecipient() botinput.WebhookRecipient
func (TgWebhookCallbackQuery) GetSender ¶
func (whi TgWebhookCallbackQuery) GetSender() botinput.WebhookUser
func (TgWebhookCallbackQuery) InputType ¶
func (twhcbq TgWebhookCallbackQuery) InputType() botinput.WebhookInputType
InputType return WebhookInputCallbackQuery
func (TgWebhookCallbackQuery) LogRequest ¶
func (whi TgWebhookCallbackQuery) LogRequest()
func (TgWebhookCallbackQuery) Sequence ¶
func (twhcbq TgWebhookCallbackQuery) Sequence() int
Sequence returns update ID
func (TgWebhookCallbackQuery) TelegramCallbackMessage ¶
func (twhcbq TgWebhookCallbackQuery) TelegramCallbackMessage() *tgbotapi.Message
TelegramCallbackMessage returns message
func (TgWebhookCallbackQuery) TelegramChatID ¶
func (whi TgWebhookCallbackQuery) TelegramChatID() int64
type TgWebhookChat ¶
type TgWebhookChat struct {
// contains filtered or unexported fields
}
TgWebhookChat is wrapper for Telegram chat
func (TgWebhookChat) GetType ¶
func (wh TgWebhookChat) GetType() string
GetType returns telegram chat type
func (TgWebhookChat) IsGroupChat ¶
func (wh TgWebhookChat) IsGroupChat() bool
IsGroupChat indicates type of chat (group or private)
type TgWebhookInlineQuery ¶
type TgWebhookInlineQuery struct {
// contains filtered or unexported fields
}
TgWebhookInlineQuery is wrapper
func (TgWebhookInlineQuery) BotChatID ¶
func (iq TgWebhookInlineQuery) BotChatID() (string, error)
BotChatID returns bot chat ID
func (TgWebhookInlineQuery) Chat ¶
func (whi TgWebhookInlineQuery) Chat() botinput.WebhookChat
func (TgWebhookInlineQuery) GetFrom ¶
func (iq TgWebhookInlineQuery) GetFrom() botinput.WebhookSender
GetFrom returns recipient
func (TgWebhookInlineQuery) GetInlineQueryID ¶
func (iq TgWebhookInlineQuery) GetInlineQueryID() string
GetInlineQueryID return inline query ID
func (TgWebhookInlineQuery) GetOffset ¶
func (iq TgWebhookInlineQuery) GetOffset() string
GetOffset returns offset
func (TgWebhookInlineQuery) GetQuery ¶
func (iq TgWebhookInlineQuery) GetQuery() string
GetQuery returns query string
func (TgWebhookInlineQuery) GetRecipient ¶
func (whi TgWebhookInlineQuery) GetRecipient() botinput.WebhookRecipient
func (TgWebhookInlineQuery) GetSender ¶
func (whi TgWebhookInlineQuery) GetSender() botinput.WebhookUser
func (TgWebhookInlineQuery) InputType ¶
func (TgWebhookInlineQuery) InputType() botinput.WebhookInputType
InputType returns WebhookInputInlineQuery
func (TgWebhookInlineQuery) LogRequest ¶
func (whi TgWebhookInlineQuery) LogRequest()
func (TgWebhookInlineQuery) TelegramChatID ¶
func (whi TgWebhookInlineQuery) TelegramChatID() int64
type TgWebhookInput ¶
TgWebhookInput is a wrapper of telegram update struct to bots framework interface
Source Files ¶
- bot_messages.go
- bot_records_fields_setter.go
- bot_records_maker.go
- dal.go
- dalgo_stores.go
- message_uid.go
- platform.go
- settings.go
- tg_webhook_handler.go
- webhook_callbackquery.go
- webhook_chat.go
- webhook_chat_left_members.go
- webhook_chat_new_members.go
- webhook_contact.go
- webhook_context_tg.go
- webhook_entry.go
- webhook_inlinequery.go
- webhook_inlineresult.go
- webhook_input.go
- webhook_message.go
- webhook_msg.go
- webhook_msg_audio.go
- webhook_msg_photo.go
- webhook_msg_sticker.go
- webhook_msg_text.go
- webhook_msg_voice.go
- webhook_responder.go
- webhook_sender.go