Documentation ¶
Index ¶
- Constants
- Variables
- func EditMessageOnCallbackQuery(whcbq bots.WebhookCallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
- func NewTelegramBot(mode strongo.Environment, ...) bots.BotSettings
- func NewTelegramWebhookHandler(botsBy bots.SettingsProvider, translatorProvider bots.TranslatorProvider) bots.WebhookHandler
- func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (bots.WebhookInput, error)
- type CallbackAnswer
- type Chat
- type ChatEntity
- type ChatInstance
- type ChatInstanceEntity
- type ChatInstanceEntityBase
- type ChatMessageUID
- type ExportChatInviteLink
- type InlineBotMessage
- type InlineMessageUID
- type LeaveChat
- type Platform
- type TgChatBase
- type TgChatEntity
- type TgChatEntityBase
- func (entity *TgChatEntityBase) CleanProperties(properties []datastore.Property) ([]datastore.Property, error)
- func (entity *TgChatEntityBase) GetPreferredLanguage() string
- func (entity *TgChatEntityBase) GetTgChatInstanceID() string
- func (entity *TgChatEntityBase) Load(ps []datastore.Property) error
- func (entity *TgChatEntityBase) Save() (properties []datastore.Property, err error)
- func (entity *TgChatEntityBase) SetAppUserIntID(id int64)
- func (entity *TgChatEntityBase) SetBotUserID(id interface{})
- func (entity *TgChatEntityBase) SetTgChatInstanceID(v string)
- type TgChatInstanceDal
- type TgMessageType
- type TgUser
- type TgUserEntity
- type TgWebhookCallbackQuery
- func (twhcbq TgWebhookCallbackQuery) BotChatID() (string, error)
- func (whi TgWebhookCallbackQuery) Chat() bots.WebhookChat
- func (twhcbq TgWebhookCallbackQuery) GetData() string
- func (twhcbq TgWebhookCallbackQuery) GetFrom() bots.WebhookSender
- func (twhcbq TgWebhookCallbackQuery) GetID() string
- func (twhcbq TgWebhookCallbackQuery) GetInlineMessageID() string
- func (twhcbq TgWebhookCallbackQuery) GetMessage() bots.WebhookMessage
- func (whi TgWebhookCallbackQuery) GetRecipient() bots.WebhookRecipient
- func (whi TgWebhookCallbackQuery) GetSender() bots.WebhookSender
- func (whi TgWebhookCallbackQuery) GetTime() time.Time
- func (twhcbq TgWebhookCallbackQuery) InputType() bots.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() bots.WebhookChat
- func (iq TgWebhookInlineQuery) GetFrom() bots.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() bots.WebhookRecipient
- func (whi TgWebhookInlineQuery) GetSender() bots.WebhookSender
- func (whi TgWebhookInlineQuery) GetTime() time.Time
- func (TgWebhookInlineQuery) InputType() bots.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 ChatInstanceKind = "TgChatInstance"
ChatInstanceKind is kind name of TgChatInstance entity
const (
// ChatKind is kind name of Telegram chat entity
ChatKind = "TgChat"
)
const PlatformID = "telegram"
PlatformID is 'telegram'
const (
// TgUserKind is kind name for Telegram user entity
TgUserKind = "TgUser"
)
Variables ¶
var CallbackCurrent bots.MessageUID = &callbackCurrent{}
CallbackCurrent is what?
var DAL dal
DAL is data access layer
var NewChatInstanceEntity func() ChatInstanceEntity
NewChatInstanceEntity is pointer to func() ChatInstanceEntity
Functions ¶
func EditMessageOnCallbackQuery ¶
func EditMessageOnCallbackQuery(whcbq bots.WebhookCallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
EditMessageOnCallbackQuery creates edit message
func NewTelegramBot ¶
func NewTelegramBot(mode strongo.Environment, profile, code, token, paymentTestToken, paymentToken, gaToken string, locale strongo.Locale) bots.BotSettings
NewTelegramBot creates definition of new telegram bot
func NewTelegramWebhookHandler ¶
func NewTelegramWebhookHandler(botsBy bots.SettingsProvider, translatorProvider bots.TranslatorProvider) bots.WebhookHandler
NewTelegramWebhookHandler creates new Telegram webhooks handler
func NewTelegramWebhookInput ¶
func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (bots.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() bots.BotMessageType
BotMessageType returns BotMessageTypeCallbackAnswer
type Chat ¶
type Chat struct { TgChatBase *ChatEntity }
type ChatEntity ¶
type ChatEntity struct { UserGroupID string `datastore:",index,omitempty"` // Do index TgChatEntityBase }
type ChatInstance ¶
type ChatInstance struct { db.StringID ChatInstanceEntity }
ChatInstance is base struct
func (*ChatInstance) Entity ¶
func (record *ChatInstance) Entity() interface{}
Entity returns entity for saving
func (ChatInstance) NewEntity ¶
func (ChatInstance) NewEntity() interface{}
NewEntity creates new entity
func (*ChatInstance) SetEntity ¶
func (record *ChatInstance) SetEntity(entity interface{})
SetEntity sets entity to record
type ChatInstanceEntity ¶
type ChatInstanceEntity interface { GetTgChatID() int64 GetPreferredLanguage() string SetPreferredLanguage(v string) }
ChatInstanceEntity describes chat instance entity interface
type ChatInstanceEntityBase ¶
type ChatInstanceEntityBase struct { TgChatID int64 `datastore:",noindex"` PreferredLanguage string `datastore:",noindex"` }
ChatInstanceEntityBase is base struct
func (ChatInstanceEntityBase) GetPreferredLanguage ¶
func (entity ChatInstanceEntityBase) GetPreferredLanguage() string
GetPreferredLanguage returns preferred language for the chat
func (ChatInstanceEntityBase) GetTgChatID ¶
func (entity ChatInstanceEntityBase) GetTgChatID() int64
GetTgChatID returns Telegram chat ID
func (*ChatInstanceEntityBase) SetPreferredLanguage ¶
func (entity *ChatInstanceEntityBase) SetPreferredLanguage(v string)
SetPreferredLanguage sets preferred language for the chat
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 ExportChatInviteLink ¶
type ExportChatInviteLink tgbotapi.ExportChatInviteLink
ExportChatInviteLink is TG message
func (ExportChatInviteLink) BotMessageType ¶
func (ExportChatInviteLink) BotMessageType() bots.BotMessageType
BotMessageType returns BotMessageTypeExportChatInviteLink
type InlineBotMessage ¶
type InlineBotMessage tgbotapi.InlineConfig
InlineBotMessage is wrapper for Telegram bot message
func (InlineBotMessage) BotMessageType ¶
func (InlineBotMessage) BotMessageType() bots.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() bots.BotMessageType
BotMessageType return BotMessageTypeLeaveChat
type TgChatBase ¶
TgChatBase holds base properties of Telegram chat entity
func (*TgChatBase) SetID ¶
func (tgChat *TgChatBase) SetID(tgBotID string, tgChatID int64)
SetID sets ID
type TgChatEntity ¶
type TgChatEntity interface { SetTgChatInstanceID(v string) GetTgChatInstanceID() string GetPreferredLanguage() string }
TgChatEntity is Telegram chat entity interface
type TgChatEntityBase ¶
type TgChatEntityBase struct { bots.BotChatEntity TelegramUserID int64 `datastore:",noindex,omitempty"` TelegramUserIDs []int64 `datastore:",noindex"` // For groups LastProcessedUpdateID int `datastore:",noindex,omitempty"` TgChatInstanceID string `datastore:",noindex,omitempty"` // Do index }
TgChatEntityBase holds base properties of Telegram chat entity
func NewTelegramChatEntity ¶
func NewTelegramChatEntity() *TgChatEntityBase
NewTelegramChatEntity create new telegram chat entity
func (*TgChatEntityBase) CleanProperties ¶
func (entity *TgChatEntityBase) CleanProperties(properties []datastore.Property) ([]datastore.Property, error)
CleanProperties cleands properties
func (*TgChatEntityBase) GetPreferredLanguage ¶
func (entity *TgChatEntityBase) GetPreferredLanguage() string
GetPreferredLanguage returns preferred language for the chat
func (*TgChatEntityBase) GetTgChatInstanceID ¶
func (entity *TgChatEntityBase) GetTgChatInstanceID() string
GetTgChatInstanceID is what it is
func (*TgChatEntityBase) Load ¶
func (entity *TgChatEntityBase) Load(ps []datastore.Property) error
Load loads entity from datastore
func (*TgChatEntityBase) Save ¶
func (entity *TgChatEntityBase) Save() (properties []datastore.Property, err error)
Save saves entity to datastore
func (*TgChatEntityBase) SetAppUserIntID ¶
func (entity *TgChatEntityBase) SetAppUserIntID(id int64)
SetAppUserIntID sets app user int ID
func (*TgChatEntityBase) SetBotUserID ¶
func (entity *TgChatEntityBase) SetBotUserID(id interface{})
SetBotUserID sets bot user int ID
func (*TgChatEntityBase) SetTgChatInstanceID ¶
func (entity *TgChatEntityBase) SetTgChatInstanceID(v string)
SetTgChatInstanceID is what it is
type TgChatInstanceDal ¶
type TgChatInstanceDal interface { GetTelegramChatInstanceByID(c context.Context, id string) (tgChatInstance ChatInstance, err error) NewTelegramChatInstance(chatInstanceID string, chatID int64, preferredLanguage string) (tgChatInstance ChatInstance) SaveTelegramChatInstance(c context.Context, tgChatInstance ChatInstance) (err error) }
TgChatInstanceDal is DAL for telegram chat instance entity
type TgUser ¶
type TgUser struct { ID int64 TgUserEntity }
TgUser is Telegram user DB record (with ID)
type TgUserEntity ¶
type TgUserEntity struct {
bots.BotUserEntity
}
TgUserEntity is Telegram user DB entity (without ID)
func (*TgUserEntity) GetNames ¶
func (entity *TgUserEntity) GetNames() user.Names
GetNames return user names
func (*TgUserEntity) IsEmailConfirmed ¶
func (entity *TgUserEntity) IsEmailConfirmed() bool
IsEmailConfirmed returns false
func (*TgUserEntity) Load ¶
func (entity *TgUserEntity) Load(ps []datastore.Property) error
Load is for datastore
func (TgUserEntity) Name ¶
func (entity TgUserEntity) Name() string
Name returns full display name cmbined from (first+last, nick) name
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) GetData ¶
func (twhcbq TgWebhookCallbackQuery) GetData() string
GetData returns callback query data
func (TgWebhookCallbackQuery) GetFrom ¶
func (twhcbq TgWebhookCallbackQuery) GetFrom() bots.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() bots.WebhookMessage
GetMessage returns message
func (TgWebhookCallbackQuery) GetRecipient ¶
func (whi TgWebhookCallbackQuery) GetRecipient() bots.WebhookRecipient
func (TgWebhookCallbackQuery) GetSender ¶
func (whi TgWebhookCallbackQuery) GetSender() bots.WebhookSender
func (TgWebhookCallbackQuery) InputType ¶
func (twhcbq TgWebhookCallbackQuery) InputType() bots.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) GetFrom ¶
func (iq TgWebhookInlineQuery) GetFrom() bots.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() bots.WebhookRecipient
func (TgWebhookInlineQuery) GetSender ¶
func (whi TgWebhookInlineQuery) GetSender() bots.WebhookSender
func (TgWebhookInlineQuery) InputType ¶
func (TgWebhookInlineQuery) InputType() bots.WebhookInputType
InputType returns WebhookInputInlineQuery
func (TgWebhookInlineQuery) LogRequest ¶
func (whi TgWebhookInlineQuery) LogRequest()
func (TgWebhookInlineQuery) TelegramChatID ¶
func (whi TgWebhookInlineQuery) TelegramChatID() int64
type TgWebhookInput ¶
type TgWebhookInput interface {
TgUpdate() *tgbotapi.Update
}
TgWebhookInput is a wrapper of telegram update struct to bots framework interface
Source Files ¶
- bot_messages.go
- dal.go
- message_uid.go
- model_chat.go
- model_chat_basic.go
- model_telegram_chat_instance.go
- model_user.go
- platform.go
- settings.go
- tg_webhooks.go
- webhook_callbackquery.go
- webhook_chat.go
- webhook_chat_left_members.go
- webhook_chat_new_members.go
- webhook_contact.go
- webhook_context.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