Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConversationCancelled = errors.New("conversation cancelled") ConversationTimeout = errors.New("conversation wait timeout") )
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// Update contains pointers to all possible update types.
Update *Updates
// Client is the gotdbot client.
Client *gotdbot.Client
// Dispatcher is the dispatcher that created this context.
Dispatcher *Dispatcher
// Data is a map for storing data across handlers.
Data map[string]interface{}
// Helper fields derived from the update
EffectiveMessage *gotdbot.Message
EffectiveChatId int64
}
func NewContext ¶
type Dispatcher ¶
type Dispatcher struct {
Client *gotdbot.Client
// PanicHandler handles panics during update processing.
PanicHandler func(c *Context, r interface{})
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(client *gotdbot.Client) *Dispatcher
func (*Dispatcher) AddHandler ¶
func (d *Dispatcher) AddHandler(h Handler)
AddHandler adds a handler to group 0.
func (*Dispatcher) AddHandlerToGroup ¶
func (d *Dispatcher) AddHandlerToGroup(h Handler, group int)
AddHandlerToGroup adds a handler to a specific group.
func (*Dispatcher) ProcessUpdate ¶
func (d *Dispatcher) ProcessUpdate(update gotdbot.TlObject)
ProcessUpdate processes a single update through the handlers.
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start()
Start registers the dispatcher with the client to receive updates. It adds itself as an "initializer" to the client, which ensures it sees all updates.
func (*Dispatcher) WaitFor ¶ added in v0.2.0
func (d *Dispatcher) WaitFor(filter UpdateFilter, timeout time.Duration) (gotdbot.TlObject, error)
WaitFor registers a waiter and blocks until a matching update arrives or timeout occurs.
type UpdateFilter ¶ added in v0.2.0
UpdateFilter is a function that returns true if the update matches the filter.
type Updates ¶
type Updates struct {
UpdateAccentColors *gotdbot.UpdateAccentColors
UpdateActiveEmojiReactions *gotdbot.UpdateActiveEmojiReactions
UpdateActiveGiftAuctions *gotdbot.UpdateActiveGiftAuctions
UpdateActiveLiveLocationMessages *gotdbot.UpdateActiveLiveLocationMessages
UpdateActiveNotifications *gotdbot.UpdateActiveNotifications
UpdateAgeVerificationParameters *gotdbot.UpdateAgeVerificationParameters
UpdateAnimatedEmojiMessageClicked *gotdbot.UpdateAnimatedEmojiMessageClicked
UpdateAnimationSearchParameters *gotdbot.UpdateAnimationSearchParameters
UpdateApplicationRecaptchaVerificationRequired *gotdbot.UpdateApplicationRecaptchaVerificationRequired
UpdateApplicationVerificationRequired *gotdbot.UpdateApplicationVerificationRequired
UpdateAttachmentMenuBots *gotdbot.UpdateAttachmentMenuBots
UpdateAuthorizationState *gotdbot.UpdateAuthorizationState
UpdateAutosaveSettings *gotdbot.UpdateAutosaveSettings
UpdateAvailableMessageEffects *gotdbot.UpdateAvailableMessageEffects
UpdateBasicGroup *gotdbot.UpdateBasicGroup
UpdateBasicGroupFullInfo *gotdbot.UpdateBasicGroupFullInfo
UpdateBusinessConnection *gotdbot.UpdateBusinessConnection
UpdateBusinessMessageEdited *gotdbot.UpdateBusinessMessageEdited
UpdateBusinessMessagesDeleted *gotdbot.UpdateBusinessMessagesDeleted
UpdateCall *gotdbot.UpdateCall
UpdateChatAccentColors *gotdbot.UpdateChatAccentColors
UpdateChatAction *gotdbot.UpdateChatAction
UpdateChatActionBar *gotdbot.UpdateChatActionBar
UpdateChatActiveStories *gotdbot.UpdateChatActiveStories
UpdateChatAddedToList *gotdbot.UpdateChatAddedToList
UpdateChatAvailableReactions *gotdbot.UpdateChatAvailableReactions
UpdateChatBackground *gotdbot.UpdateChatBackground
UpdateChatBlockList *gotdbot.UpdateChatBlockList
UpdateChatBoost *gotdbot.UpdateChatBoost
UpdateChatBusinessBotManageBar *gotdbot.UpdateChatBusinessBotManageBar
UpdateChatDefaultDisableNotification *gotdbot.UpdateChatDefaultDisableNotification
UpdateChatDraftMessage *gotdbot.UpdateChatDraftMessage
UpdateChatEmojiStatus *gotdbot.UpdateChatEmojiStatus
UpdateChatFolders *gotdbot.UpdateChatFolders
UpdateChatHasProtectedContent *gotdbot.UpdateChatHasProtectedContent
UpdateChatHasScheduledMessages *gotdbot.UpdateChatHasScheduledMessages
UpdateChatIsMarkedAsUnread *gotdbot.UpdateChatIsMarkedAsUnread
UpdateChatIsTranslatable *gotdbot.UpdateChatIsTranslatable
UpdateChatLastMessage *gotdbot.UpdateChatLastMessage
UpdateChatMember *gotdbot.UpdateChatMember
UpdateChatMessageAutoDeleteTime *gotdbot.UpdateChatMessageAutoDeleteTime
UpdateChatMessageSender *gotdbot.UpdateChatMessageSender
UpdateChatNotificationSettings *gotdbot.UpdateChatNotificationSettings
UpdateChatOnlineMemberCount *gotdbot.UpdateChatOnlineMemberCount
UpdateChatPendingJoinRequests *gotdbot.UpdateChatPendingJoinRequests
UpdateChatPermissions *gotdbot.UpdateChatPermissions
UpdateChatPhoto *gotdbot.UpdateChatPhoto
UpdateChatPosition *gotdbot.UpdateChatPosition
UpdateChatReadInbox *gotdbot.UpdateChatReadInbox
UpdateChatReadOutbox *gotdbot.UpdateChatReadOutbox
UpdateChatRemovedFromList *gotdbot.UpdateChatRemovedFromList
UpdateChatReplyMarkup *gotdbot.UpdateChatReplyMarkup
UpdateChatRevenueAmount *gotdbot.UpdateChatRevenueAmount
UpdateChatTheme *gotdbot.UpdateChatTheme
UpdateChatTitle *gotdbot.UpdateChatTitle
UpdateChatUnreadMentionCount *gotdbot.UpdateChatUnreadMentionCount
UpdateChatUnreadReactionCount *gotdbot.UpdateChatUnreadReactionCount
UpdateChatVideoChat *gotdbot.UpdateChatVideoChat
UpdateChatViewAsTopics *gotdbot.UpdateChatViewAsTopics
UpdateConnectionState *gotdbot.UpdateConnectionState
UpdateContactCloseBirthdays *gotdbot.UpdateContactCloseBirthdays
UpdateDefaultBackground *gotdbot.UpdateDefaultBackground
UpdateDefaultPaidReactionType *gotdbot.UpdateDefaultPaidReactionType
UpdateDefaultReactionType *gotdbot.UpdateDefaultReactionType
UpdateDeleteMessages *gotdbot.UpdateDeleteMessages
UpdateDiceEmojis *gotdbot.UpdateDiceEmojis
UpdateDirectMessagesChatTopic *gotdbot.UpdateDirectMessagesChatTopic
UpdateEmojiChatThemes *gotdbot.UpdateEmojiChatThemes
UpdateFavoriteStickers *gotdbot.UpdateFavoriteStickers
UpdateFile *gotdbot.UpdateFile
UpdateFileAddedToDownloads *gotdbot.UpdateFileAddedToDownloads
UpdateFileDownload *gotdbot.UpdateFileDownload
UpdateFileDownloads *gotdbot.UpdateFileDownloads
UpdateFileGenerationStart *gotdbot.UpdateFileGenerationStart
UpdateFileGenerationStop *gotdbot.UpdateFileGenerationStop
UpdateFileRemovedFromDownloads *gotdbot.UpdateFileRemovedFromDownloads
UpdateForumTopic *gotdbot.UpdateForumTopic
UpdateForumTopicInfo *gotdbot.UpdateForumTopicInfo
UpdateFreezeState *gotdbot.UpdateFreezeState
UpdateGiftAuctionState *gotdbot.UpdateGiftAuctionState
UpdateGroupCall *gotdbot.UpdateGroupCall
UpdateGroupCallMessageLevels *gotdbot.UpdateGroupCallMessageLevels
UpdateGroupCallMessagesDeleted *gotdbot.UpdateGroupCallMessagesDeleted
UpdateGroupCallMessageSendFailed *gotdbot.UpdateGroupCallMessageSendFailed
UpdateGroupCallParticipant *gotdbot.UpdateGroupCallParticipant
UpdateGroupCallParticipants *gotdbot.UpdateGroupCallParticipants
UpdateGroupCallVerificationState *gotdbot.UpdateGroupCallVerificationState
UpdateHavePendingNotifications *gotdbot.UpdateHavePendingNotifications
UpdateInstalledStickerSets *gotdbot.UpdateInstalledStickerSets
UpdateLanguagePackStrings *gotdbot.UpdateLanguagePackStrings
UpdateLiveStoryTopDonors *gotdbot.UpdateLiveStoryTopDonors
UpdateMessageContent *gotdbot.UpdateMessageContent
UpdateMessageContentOpened *gotdbot.UpdateMessageContentOpened
UpdateMessageEdited *gotdbot.UpdateMessageEdited
UpdateMessageFactCheck *gotdbot.UpdateMessageFactCheck
UpdateMessageInteractionInfo *gotdbot.UpdateMessageInteractionInfo
UpdateMessageIsPinned *gotdbot.UpdateMessageIsPinned
UpdateMessageLiveLocationViewed *gotdbot.UpdateMessageLiveLocationViewed
UpdateMessageMentionRead *gotdbot.UpdateMessageMentionRead
UpdateMessageReaction *gotdbot.UpdateMessageReaction
UpdateMessageReactions *gotdbot.UpdateMessageReactions
UpdateMessageSendAcknowledged *gotdbot.UpdateMessageSendAcknowledged
UpdateMessageSendFailed *gotdbot.UpdateMessageSendFailed
UpdateMessageSendSucceeded *gotdbot.UpdateMessageSendSucceeded
UpdateMessageSuggestedPostInfo *gotdbot.UpdateMessageSuggestedPostInfo
UpdateMessageUnreadReactions *gotdbot.UpdateMessageUnreadReactions
UpdateNewBusinessCallbackQuery *gotdbot.UpdateNewBusinessCallbackQuery
UpdateNewBusinessMessage *gotdbot.UpdateNewBusinessMessage
UpdateNewCallbackQuery *gotdbot.UpdateNewCallbackQuery
UpdateNewCallSignalingData *gotdbot.UpdateNewCallSignalingData
UpdateNewChat *gotdbot.UpdateNewChat
UpdateNewChatJoinRequest *gotdbot.UpdateNewChatJoinRequest
UpdateNewChosenInlineResult *gotdbot.UpdateNewChosenInlineResult
UpdateNewCustomEvent *gotdbot.UpdateNewCustomEvent
UpdateNewCustomQuery *gotdbot.UpdateNewCustomQuery
UpdateNewGroupCallMessage *gotdbot.UpdateNewGroupCallMessage
UpdateNewGroupCallPaidReaction *gotdbot.UpdateNewGroupCallPaidReaction
UpdateNewInlineCallbackQuery *gotdbot.UpdateNewInlineCallbackQuery
UpdateNewInlineQuery *gotdbot.UpdateNewInlineQuery
UpdateNewMessage *gotdbot.UpdateNewMessage
UpdateNewPreCheckoutQuery *gotdbot.UpdateNewPreCheckoutQuery
UpdateNewShippingQuery *gotdbot.UpdateNewShippingQuery
UpdateNotification *gotdbot.UpdateNotification
UpdateNotificationGroup *gotdbot.UpdateNotificationGroup
UpdateOption *gotdbot.UpdateOption
UpdateOwnedStarCount *gotdbot.UpdateOwnedStarCount
UpdateOwnedTonCount *gotdbot.UpdateOwnedTonCount
UpdatePaidMediaPurchased *gotdbot.UpdatePaidMediaPurchased
UpdatePendingTextMessage *gotdbot.UpdatePendingTextMessage
UpdatePoll *gotdbot.UpdatePoll
UpdatePollAnswer *gotdbot.UpdatePollAnswer
UpdateProfileAccentColors *gotdbot.UpdateProfileAccentColors
UpdateQuickReplyShortcut *gotdbot.UpdateQuickReplyShortcut
UpdateQuickReplyShortcutDeleted *gotdbot.UpdateQuickReplyShortcutDeleted
UpdateQuickReplyShortcutMessages *gotdbot.UpdateQuickReplyShortcutMessages
UpdateQuickReplyShortcuts *gotdbot.UpdateQuickReplyShortcuts
UpdateReactionNotificationSettings *gotdbot.UpdateReactionNotificationSettings
UpdateRecentStickers *gotdbot.UpdateRecentStickers
UpdateSavedAnimations *gotdbot.UpdateSavedAnimations
UpdateSavedMessagesTags *gotdbot.UpdateSavedMessagesTags
UpdateSavedMessagesTopic *gotdbot.UpdateSavedMessagesTopic
UpdateSavedMessagesTopicCount *gotdbot.UpdateSavedMessagesTopicCount
UpdateSavedNotificationSounds *gotdbot.UpdateSavedNotificationSounds
UpdateScopeNotificationSettings *gotdbot.UpdateScopeNotificationSettings
UpdateSecretChat *gotdbot.UpdateSecretChat
UpdateServiceNotification *gotdbot.UpdateServiceNotification
UpdateSpeechRecognitionTrial *gotdbot.UpdateSpeechRecognitionTrial
UpdateSpeedLimitNotification *gotdbot.UpdateSpeedLimitNotification
UpdateStakeDiceState *gotdbot.UpdateStakeDiceState
UpdateStarRevenueStatus *gotdbot.UpdateStarRevenueStatus
UpdateStickerSet *gotdbot.UpdateStickerSet
UpdateStory *gotdbot.UpdateStory
UpdateStoryDeleted *gotdbot.UpdateStoryDeleted
UpdateStoryListChatCount *gotdbot.UpdateStoryListChatCount
UpdateStoryPostFailed *gotdbot.UpdateStoryPostFailed
UpdateStoryPostSucceeded *gotdbot.UpdateStoryPostSucceeded
UpdateStoryStealthMode *gotdbot.UpdateStoryStealthMode
UpdateSuggestedActions *gotdbot.UpdateSuggestedActions
UpdateSupergroup *gotdbot.UpdateSupergroup
UpdateSupergroupFullInfo *gotdbot.UpdateSupergroupFullInfo
UpdateTermsOfService *gotdbot.UpdateTermsOfService
UpdateTonRevenueStatus *gotdbot.UpdateTonRevenueStatus
UpdateTopicMessageCount *gotdbot.UpdateTopicMessageCount
UpdateTrendingStickerSets *gotdbot.UpdateTrendingStickerSets
UpdateTrustedMiniAppBots *gotdbot.UpdateTrustedMiniAppBots
UpdateUnconfirmedSession *gotdbot.UpdateUnconfirmedSession
UpdateUnreadChatCount *gotdbot.UpdateUnreadChatCount
UpdateUnreadMessageCount *gotdbot.UpdateUnreadMessageCount
UpdateUser *gotdbot.UpdateUser
UpdateUserFullInfo *gotdbot.UpdateUserFullInfo
UpdateUserPrivacySettingRules *gotdbot.UpdateUserPrivacySettingRules
UpdateUserStatus *gotdbot.UpdateUserStatus
UpdateVideoPublished *gotdbot.UpdateVideoPublished
UpdateWebAppMessageSent *gotdbot.UpdateWebAppMessageSent
}
func NewUpdates ¶
type WaitMessageOpts ¶ added in v0.3.0
type WaitMessageOpts struct {
Filter func(*gotdbot.Message) bool
CancellationFilter func(*gotdbot.Message) bool
Timeout time.Duration
}
WaitMessageOpts holds optional parameters for Ask.
type Waiter ¶ added in v0.2.0
type Waiter struct {
Filter UpdateFilter
C chan gotdbot.TlObject
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.