package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type handler = func (context .Context , Entities , UpdateClass ) error
type UpdateDispatcher struct {
handlers map [uint32 ]handler
}
func NewUpdateDispatcher () UpdateDispatcher {
return UpdateDispatcher {
handlers : map [uint32 ]handler {},
}
}
type Entities struct {
Short bool
Users map [int64 ]*User
Chats map [int64 ]*Chat
Channels map [int64 ]*Channel
}
func (u *Entities ) short () {
u .Short = true
u .Users = make (map [int64 ]*User , 0 )
u .Chats = make (map [int64 ]*Chat , 0 )
u .Channels = make (map [int64 ]*Channel , 0 )
}
func (u UpdateDispatcher ) Handle (ctx context .Context , updates UpdatesClass ) error {
var (
e Entities
upds []UpdateClass
)
switch u := updates .(type ) {
case *Updates :
upds = u .Updates
e .Users = u .MapUsers ().NotEmptyToMap ()
chats := u .MapChats ()
e .Chats = chats .ChatToMap ()
e .Channels = chats .ChannelToMap ()
case *UpdatesCombined :
upds = u .Updates
e .Users = u .MapUsers ().NotEmptyToMap ()
chats := u .MapChats ()
e .Chats = chats .ChatToMap ()
e .Channels = chats .ChannelToMap ()
case *UpdateShort :
upds = []UpdateClass {u .Update }
e .short ()
default :
return nil
}
var err error
for _ , update := range upds {
multierr .AppendInto (&err , u .dispatch (ctx , e , update ))
}
return err
}
func (u UpdateDispatcher ) dispatch (ctx context .Context , e Entities , update UpdateClass ) error {
if update == nil {
return nil
}
typeID := update .TypeID ()
handler , ok := u .handlers [typeID ]
if !ok {
return nil
}
return handler (ctx , e , update )
}
type NewMessageHandler func (ctx context .Context , e Entities , update *UpdateNewMessage ) error
func (u UpdateDispatcher ) OnNewMessage (handler NewMessageHandler ) {
u .handlers [UpdateNewMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewMessage ))
}
}
type MessageIDHandler func (ctx context .Context , e Entities , update *UpdateMessageID ) error
func (u UpdateDispatcher ) OnMessageID (handler MessageIDHandler ) {
u .handlers [UpdateMessageIDTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMessageID ))
}
}
type DeleteMessagesHandler func (ctx context .Context , e Entities , update *UpdateDeleteMessages ) error
func (u UpdateDispatcher ) OnDeleteMessages (handler DeleteMessagesHandler ) {
u .handlers [UpdateDeleteMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDeleteMessages ))
}
}
type UserTypingHandler func (ctx context .Context , e Entities , update *UpdateUserTyping ) error
func (u UpdateDispatcher ) OnUserTyping (handler UserTypingHandler ) {
u .handlers [UpdateUserTypingTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUserTyping ))
}
}
type ChatUserTypingHandler func (ctx context .Context , e Entities , update *UpdateChatUserTyping ) error
func (u UpdateDispatcher ) OnChatUserTyping (handler ChatUserTypingHandler ) {
u .handlers [UpdateChatUserTypingTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatUserTyping ))
}
}
type ChatParticipantsHandler func (ctx context .Context , e Entities , update *UpdateChatParticipants ) error
func (u UpdateDispatcher ) OnChatParticipants (handler ChatParticipantsHandler ) {
u .handlers [UpdateChatParticipantsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatParticipants ))
}
}
type UserStatusHandler func (ctx context .Context , e Entities , update *UpdateUserStatus ) error
func (u UpdateDispatcher ) OnUserStatus (handler UserStatusHandler ) {
u .handlers [UpdateUserStatusTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUserStatus ))
}
}
type UserNameHandler func (ctx context .Context , e Entities , update *UpdateUserName ) error
func (u UpdateDispatcher ) OnUserName (handler UserNameHandler ) {
u .handlers [UpdateUserNameTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUserName ))
}
}
type NewAuthorizationHandler func (ctx context .Context , e Entities , update *UpdateNewAuthorization ) error
func (u UpdateDispatcher ) OnNewAuthorization (handler NewAuthorizationHandler ) {
u .handlers [UpdateNewAuthorizationTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewAuthorization ))
}
}
type NewEncryptedMessageHandler func (ctx context .Context , e Entities , update *UpdateNewEncryptedMessage ) error
func (u UpdateDispatcher ) OnNewEncryptedMessage (handler NewEncryptedMessageHandler ) {
u .handlers [UpdateNewEncryptedMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewEncryptedMessage ))
}
}
type EncryptedChatTypingHandler func (ctx context .Context , e Entities , update *UpdateEncryptedChatTyping ) error
func (u UpdateDispatcher ) OnEncryptedChatTyping (handler EncryptedChatTypingHandler ) {
u .handlers [UpdateEncryptedChatTypingTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateEncryptedChatTyping ))
}
}
type EncryptionHandler func (ctx context .Context , e Entities , update *UpdateEncryption ) error
func (u UpdateDispatcher ) OnEncryption (handler EncryptionHandler ) {
u .handlers [UpdateEncryptionTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateEncryption ))
}
}
type EncryptedMessagesReadHandler func (ctx context .Context , e Entities , update *UpdateEncryptedMessagesRead ) error
func (u UpdateDispatcher ) OnEncryptedMessagesRead (handler EncryptedMessagesReadHandler ) {
u .handlers [UpdateEncryptedMessagesReadTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateEncryptedMessagesRead ))
}
}
type ChatParticipantAddHandler func (ctx context .Context , e Entities , update *UpdateChatParticipantAdd ) error
func (u UpdateDispatcher ) OnChatParticipantAdd (handler ChatParticipantAddHandler ) {
u .handlers [UpdateChatParticipantAddTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatParticipantAdd ))
}
}
type ChatParticipantDeleteHandler func (ctx context .Context , e Entities , update *UpdateChatParticipantDelete ) error
func (u UpdateDispatcher ) OnChatParticipantDelete (handler ChatParticipantDeleteHandler ) {
u .handlers [UpdateChatParticipantDeleteTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatParticipantDelete ))
}
}
type DCOptionsHandler func (ctx context .Context , e Entities , update *UpdateDCOptions ) error
func (u UpdateDispatcher ) OnDCOptions (handler DCOptionsHandler ) {
u .handlers [UpdateDCOptionsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDCOptions ))
}
}
type NotifySettingsHandler func (ctx context .Context , e Entities , update *UpdateNotifySettings ) error
func (u UpdateDispatcher ) OnNotifySettings (handler NotifySettingsHandler ) {
u .handlers [UpdateNotifySettingsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNotifySettings ))
}
}
type ServiceNotificationHandler func (ctx context .Context , e Entities , update *UpdateServiceNotification ) error
func (u UpdateDispatcher ) OnServiceNotification (handler ServiceNotificationHandler ) {
u .handlers [UpdateServiceNotificationTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateServiceNotification ))
}
}
type PrivacyHandler func (ctx context .Context , e Entities , update *UpdatePrivacy ) error
func (u UpdateDispatcher ) OnPrivacy (handler PrivacyHandler ) {
u .handlers [UpdatePrivacyTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePrivacy ))
}
}
type UserPhoneHandler func (ctx context .Context , e Entities , update *UpdateUserPhone ) error
func (u UpdateDispatcher ) OnUserPhone (handler UserPhoneHandler ) {
u .handlers [UpdateUserPhoneTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUserPhone ))
}
}
type ReadHistoryInboxHandler func (ctx context .Context , e Entities , update *UpdateReadHistoryInbox ) error
func (u UpdateDispatcher ) OnReadHistoryInbox (handler ReadHistoryInboxHandler ) {
u .handlers [UpdateReadHistoryInboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadHistoryInbox ))
}
}
type ReadHistoryOutboxHandler func (ctx context .Context , e Entities , update *UpdateReadHistoryOutbox ) error
func (u UpdateDispatcher ) OnReadHistoryOutbox (handler ReadHistoryOutboxHandler ) {
u .handlers [UpdateReadHistoryOutboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadHistoryOutbox ))
}
}
type WebPageHandler func (ctx context .Context , e Entities , update *UpdateWebPage ) error
func (u UpdateDispatcher ) OnWebPage (handler WebPageHandler ) {
u .handlers [UpdateWebPageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateWebPage ))
}
}
type ReadMessagesContentsHandler func (ctx context .Context , e Entities , update *UpdateReadMessagesContents ) error
func (u UpdateDispatcher ) OnReadMessagesContents (handler ReadMessagesContentsHandler ) {
u .handlers [UpdateReadMessagesContentsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadMessagesContents ))
}
}
type ChannelTooLongHandler func (ctx context .Context , e Entities , update *UpdateChannelTooLong ) error
func (u UpdateDispatcher ) OnChannelTooLong (handler ChannelTooLongHandler ) {
u .handlers [UpdateChannelTooLongTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelTooLong ))
}
}
type ChannelHandler func (ctx context .Context , e Entities , update *UpdateChannel ) error
func (u UpdateDispatcher ) OnChannel (handler ChannelHandler ) {
u .handlers [UpdateChannelTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannel ))
}
}
type NewChannelMessageHandler func (ctx context .Context , e Entities , update *UpdateNewChannelMessage ) error
func (u UpdateDispatcher ) OnNewChannelMessage (handler NewChannelMessageHandler ) {
u .handlers [UpdateNewChannelMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewChannelMessage ))
}
}
type ReadChannelInboxHandler func (ctx context .Context , e Entities , update *UpdateReadChannelInbox ) error
func (u UpdateDispatcher ) OnReadChannelInbox (handler ReadChannelInboxHandler ) {
u .handlers [UpdateReadChannelInboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadChannelInbox ))
}
}
type DeleteChannelMessagesHandler func (ctx context .Context , e Entities , update *UpdateDeleteChannelMessages ) error
func (u UpdateDispatcher ) OnDeleteChannelMessages (handler DeleteChannelMessagesHandler ) {
u .handlers [UpdateDeleteChannelMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDeleteChannelMessages ))
}
}
type ChannelMessageViewsHandler func (ctx context .Context , e Entities , update *UpdateChannelMessageViews ) error
func (u UpdateDispatcher ) OnChannelMessageViews (handler ChannelMessageViewsHandler ) {
u .handlers [UpdateChannelMessageViewsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelMessageViews ))
}
}
type ChatParticipantAdminHandler func (ctx context .Context , e Entities , update *UpdateChatParticipantAdmin ) error
func (u UpdateDispatcher ) OnChatParticipantAdmin (handler ChatParticipantAdminHandler ) {
u .handlers [UpdateChatParticipantAdminTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatParticipantAdmin ))
}
}
type NewStickerSetHandler func (ctx context .Context , e Entities , update *UpdateNewStickerSet ) error
func (u UpdateDispatcher ) OnNewStickerSet (handler NewStickerSetHandler ) {
u .handlers [UpdateNewStickerSetTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewStickerSet ))
}
}
type StickerSetsOrderHandler func (ctx context .Context , e Entities , update *UpdateStickerSetsOrder ) error
func (u UpdateDispatcher ) OnStickerSetsOrder (handler StickerSetsOrderHandler ) {
u .handlers [UpdateStickerSetsOrderTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateStickerSetsOrder ))
}
}
type StickerSetsHandler func (ctx context .Context , e Entities , update *UpdateStickerSets ) error
func (u UpdateDispatcher ) OnStickerSets (handler StickerSetsHandler ) {
u .handlers [UpdateStickerSetsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateStickerSets ))
}
}
type SavedGifsHandler func (ctx context .Context , e Entities , update *UpdateSavedGifs ) error
func (u UpdateDispatcher ) OnSavedGifs (handler SavedGifsHandler ) {
u .handlers [UpdateSavedGifsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateSavedGifs ))
}
}
type BotInlineQueryHandler func (ctx context .Context , e Entities , update *UpdateBotInlineQuery ) error
func (u UpdateDispatcher ) OnBotInlineQuery (handler BotInlineQueryHandler ) {
u .handlers [UpdateBotInlineQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotInlineQuery ))
}
}
type BotInlineSendHandler func (ctx context .Context , e Entities , update *UpdateBotInlineSend ) error
func (u UpdateDispatcher ) OnBotInlineSend (handler BotInlineSendHandler ) {
u .handlers [UpdateBotInlineSendTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotInlineSend ))
}
}
type EditChannelMessageHandler func (ctx context .Context , e Entities , update *UpdateEditChannelMessage ) error
func (u UpdateDispatcher ) OnEditChannelMessage (handler EditChannelMessageHandler ) {
u .handlers [UpdateEditChannelMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateEditChannelMessage ))
}
}
type BotCallbackQueryHandler func (ctx context .Context , e Entities , update *UpdateBotCallbackQuery ) error
func (u UpdateDispatcher ) OnBotCallbackQuery (handler BotCallbackQueryHandler ) {
u .handlers [UpdateBotCallbackQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotCallbackQuery ))
}
}
type EditMessageHandler func (ctx context .Context , e Entities , update *UpdateEditMessage ) error
func (u UpdateDispatcher ) OnEditMessage (handler EditMessageHandler ) {
u .handlers [UpdateEditMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateEditMessage ))
}
}
type InlineBotCallbackQueryHandler func (ctx context .Context , e Entities , update *UpdateInlineBotCallbackQuery ) error
func (u UpdateDispatcher ) OnInlineBotCallbackQuery (handler InlineBotCallbackQueryHandler ) {
u .handlers [UpdateInlineBotCallbackQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateInlineBotCallbackQuery ))
}
}
type ReadChannelOutboxHandler func (ctx context .Context , e Entities , update *UpdateReadChannelOutbox ) error
func (u UpdateDispatcher ) OnReadChannelOutbox (handler ReadChannelOutboxHandler ) {
u .handlers [UpdateReadChannelOutboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadChannelOutbox ))
}
}
type DraftMessageHandler func (ctx context .Context , e Entities , update *UpdateDraftMessage ) error
func (u UpdateDispatcher ) OnDraftMessage (handler DraftMessageHandler ) {
u .handlers [UpdateDraftMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDraftMessage ))
}
}
type ReadFeaturedStickersHandler func (ctx context .Context , e Entities , update *UpdateReadFeaturedStickers ) error
func (u UpdateDispatcher ) OnReadFeaturedStickers (handler ReadFeaturedStickersHandler ) {
u .handlers [UpdateReadFeaturedStickersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadFeaturedStickers ))
}
}
type RecentStickersHandler func (ctx context .Context , e Entities , update *UpdateRecentStickers ) error
func (u UpdateDispatcher ) OnRecentStickers (handler RecentStickersHandler ) {
u .handlers [UpdateRecentStickersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateRecentStickers ))
}
}
type ConfigHandler func (ctx context .Context , e Entities , update *UpdateConfig ) error
func (u UpdateDispatcher ) OnConfig (handler ConfigHandler ) {
u .handlers [UpdateConfigTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateConfig ))
}
}
type PtsChangedHandler func (ctx context .Context , e Entities , update *UpdatePtsChanged ) error
func (u UpdateDispatcher ) OnPtsChanged (handler PtsChangedHandler ) {
u .handlers [UpdatePtsChangedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePtsChanged ))
}
}
type ChannelWebPageHandler func (ctx context .Context , e Entities , update *UpdateChannelWebPage ) error
func (u UpdateDispatcher ) OnChannelWebPage (handler ChannelWebPageHandler ) {
u .handlers [UpdateChannelWebPageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelWebPage ))
}
}
type DialogPinnedHandler func (ctx context .Context , e Entities , update *UpdateDialogPinned ) error
func (u UpdateDispatcher ) OnDialogPinned (handler DialogPinnedHandler ) {
u .handlers [UpdateDialogPinnedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDialogPinned ))
}
}
type PinnedDialogsHandler func (ctx context .Context , e Entities , update *UpdatePinnedDialogs ) error
func (u UpdateDispatcher ) OnPinnedDialogs (handler PinnedDialogsHandler ) {
u .handlers [UpdatePinnedDialogsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePinnedDialogs ))
}
}
type BotWebhookJSONHandler func (ctx context .Context , e Entities , update *UpdateBotWebhookJSON ) error
func (u UpdateDispatcher ) OnBotWebhookJSON (handler BotWebhookJSONHandler ) {
u .handlers [UpdateBotWebhookJSONTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotWebhookJSON ))
}
}
type BotWebhookJSONQueryHandler func (ctx context .Context , e Entities , update *UpdateBotWebhookJSONQuery ) error
func (u UpdateDispatcher ) OnBotWebhookJSONQuery (handler BotWebhookJSONQueryHandler ) {
u .handlers [UpdateBotWebhookJSONQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotWebhookJSONQuery ))
}
}
type BotShippingQueryHandler func (ctx context .Context , e Entities , update *UpdateBotShippingQuery ) error
func (u UpdateDispatcher ) OnBotShippingQuery (handler BotShippingQueryHandler ) {
u .handlers [UpdateBotShippingQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotShippingQuery ))
}
}
type BotPrecheckoutQueryHandler func (ctx context .Context , e Entities , update *UpdateBotPrecheckoutQuery ) error
func (u UpdateDispatcher ) OnBotPrecheckoutQuery (handler BotPrecheckoutQueryHandler ) {
u .handlers [UpdateBotPrecheckoutQueryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotPrecheckoutQuery ))
}
}
type PhoneCallHandler func (ctx context .Context , e Entities , update *UpdatePhoneCall ) error
func (u UpdateDispatcher ) OnPhoneCall (handler PhoneCallHandler ) {
u .handlers [UpdatePhoneCallTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePhoneCall ))
}
}
type LangPackTooLongHandler func (ctx context .Context , e Entities , update *UpdateLangPackTooLong ) error
func (u UpdateDispatcher ) OnLangPackTooLong (handler LangPackTooLongHandler ) {
u .handlers [UpdateLangPackTooLongTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateLangPackTooLong ))
}
}
type LangPackHandler func (ctx context .Context , e Entities , update *UpdateLangPack ) error
func (u UpdateDispatcher ) OnLangPack (handler LangPackHandler ) {
u .handlers [UpdateLangPackTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateLangPack ))
}
}
type FavedStickersHandler func (ctx context .Context , e Entities , update *UpdateFavedStickers ) error
func (u UpdateDispatcher ) OnFavedStickers (handler FavedStickersHandler ) {
u .handlers [UpdateFavedStickersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateFavedStickers ))
}
}
type ChannelReadMessagesContentsHandler func (ctx context .Context , e Entities , update *UpdateChannelReadMessagesContents ) error
func (u UpdateDispatcher ) OnChannelReadMessagesContents (handler ChannelReadMessagesContentsHandler ) {
u .handlers [UpdateChannelReadMessagesContentsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelReadMessagesContents ))
}
}
type ContactsResetHandler func (ctx context .Context , e Entities , update *UpdateContactsReset ) error
func (u UpdateDispatcher ) OnContactsReset (handler ContactsResetHandler ) {
u .handlers [UpdateContactsResetTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateContactsReset ))
}
}
type ChannelAvailableMessagesHandler func (ctx context .Context , e Entities , update *UpdateChannelAvailableMessages ) error
func (u UpdateDispatcher ) OnChannelAvailableMessages (handler ChannelAvailableMessagesHandler ) {
u .handlers [UpdateChannelAvailableMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelAvailableMessages ))
}
}
type DialogUnreadMarkHandler func (ctx context .Context , e Entities , update *UpdateDialogUnreadMark ) error
func (u UpdateDispatcher ) OnDialogUnreadMark (handler DialogUnreadMarkHandler ) {
u .handlers [UpdateDialogUnreadMarkTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDialogUnreadMark ))
}
}
type MessagePollHandler func (ctx context .Context , e Entities , update *UpdateMessagePoll ) error
func (u UpdateDispatcher ) OnMessagePoll (handler MessagePollHandler ) {
u .handlers [UpdateMessagePollTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMessagePoll ))
}
}
type ChatDefaultBannedRightsHandler func (ctx context .Context , e Entities , update *UpdateChatDefaultBannedRights ) error
func (u UpdateDispatcher ) OnChatDefaultBannedRights (handler ChatDefaultBannedRightsHandler ) {
u .handlers [UpdateChatDefaultBannedRightsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatDefaultBannedRights ))
}
}
type FolderPeersHandler func (ctx context .Context , e Entities , update *UpdateFolderPeers ) error
func (u UpdateDispatcher ) OnFolderPeers (handler FolderPeersHandler ) {
u .handlers [UpdateFolderPeersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateFolderPeers ))
}
}
type PeerSettingsHandler func (ctx context .Context , e Entities , update *UpdatePeerSettings ) error
func (u UpdateDispatcher ) OnPeerSettings (handler PeerSettingsHandler ) {
u .handlers [UpdatePeerSettingsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePeerSettings ))
}
}
type PeerLocatedHandler func (ctx context .Context , e Entities , update *UpdatePeerLocated ) error
func (u UpdateDispatcher ) OnPeerLocated (handler PeerLocatedHandler ) {
u .handlers [UpdatePeerLocatedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePeerLocated ))
}
}
type NewScheduledMessageHandler func (ctx context .Context , e Entities , update *UpdateNewScheduledMessage ) error
func (u UpdateDispatcher ) OnNewScheduledMessage (handler NewScheduledMessageHandler ) {
u .handlers [UpdateNewScheduledMessageTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateNewScheduledMessage ))
}
}
type DeleteScheduledMessagesHandler func (ctx context .Context , e Entities , update *UpdateDeleteScheduledMessages ) error
func (u UpdateDispatcher ) OnDeleteScheduledMessages (handler DeleteScheduledMessagesHandler ) {
u .handlers [UpdateDeleteScheduledMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDeleteScheduledMessages ))
}
}
type ThemeHandler func (ctx context .Context , e Entities , update *UpdateTheme ) error
func (u UpdateDispatcher ) OnTheme (handler ThemeHandler ) {
u .handlers [UpdateThemeTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateTheme ))
}
}
type GeoLiveViewedHandler func (ctx context .Context , e Entities , update *UpdateGeoLiveViewed ) error
func (u UpdateDispatcher ) OnGeoLiveViewed (handler GeoLiveViewedHandler ) {
u .handlers [UpdateGeoLiveViewedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateGeoLiveViewed ))
}
}
type LoginTokenHandler func (ctx context .Context , e Entities , update *UpdateLoginToken ) error
func (u UpdateDispatcher ) OnLoginToken (handler LoginTokenHandler ) {
u .handlers [UpdateLoginTokenTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateLoginToken ))
}
}
type MessagePollVoteHandler func (ctx context .Context , e Entities , update *UpdateMessagePollVote ) error
func (u UpdateDispatcher ) OnMessagePollVote (handler MessagePollVoteHandler ) {
u .handlers [UpdateMessagePollVoteTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMessagePollVote ))
}
}
type DialogFilterHandler func (ctx context .Context , e Entities , update *UpdateDialogFilter ) error
func (u UpdateDispatcher ) OnDialogFilter (handler DialogFilterHandler ) {
u .handlers [UpdateDialogFilterTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDialogFilter ))
}
}
type DialogFilterOrderHandler func (ctx context .Context , e Entities , update *UpdateDialogFilterOrder ) error
func (u UpdateDispatcher ) OnDialogFilterOrder (handler DialogFilterOrderHandler ) {
u .handlers [UpdateDialogFilterOrderTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDialogFilterOrder ))
}
}
type DialogFiltersHandler func (ctx context .Context , e Entities , update *UpdateDialogFilters ) error
func (u UpdateDispatcher ) OnDialogFilters (handler DialogFiltersHandler ) {
u .handlers [UpdateDialogFiltersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateDialogFilters ))
}
}
type PhoneCallSignalingDataHandler func (ctx context .Context , e Entities , update *UpdatePhoneCallSignalingData ) error
func (u UpdateDispatcher ) OnPhoneCallSignalingData (handler PhoneCallSignalingDataHandler ) {
u .handlers [UpdatePhoneCallSignalingDataTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePhoneCallSignalingData ))
}
}
type ChannelMessageForwardsHandler func (ctx context .Context , e Entities , update *UpdateChannelMessageForwards ) error
func (u UpdateDispatcher ) OnChannelMessageForwards (handler ChannelMessageForwardsHandler ) {
u .handlers [UpdateChannelMessageForwardsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelMessageForwards ))
}
}
type ReadChannelDiscussionInboxHandler func (ctx context .Context , e Entities , update *UpdateReadChannelDiscussionInbox ) error
func (u UpdateDispatcher ) OnReadChannelDiscussionInbox (handler ReadChannelDiscussionInboxHandler ) {
u .handlers [UpdateReadChannelDiscussionInboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadChannelDiscussionInbox ))
}
}
type ReadChannelDiscussionOutboxHandler func (ctx context .Context , e Entities , update *UpdateReadChannelDiscussionOutbox ) error
func (u UpdateDispatcher ) OnReadChannelDiscussionOutbox (handler ReadChannelDiscussionOutboxHandler ) {
u .handlers [UpdateReadChannelDiscussionOutboxTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadChannelDiscussionOutbox ))
}
}
type PeerBlockedHandler func (ctx context .Context , e Entities , update *UpdatePeerBlocked ) error
func (u UpdateDispatcher ) OnPeerBlocked (handler PeerBlockedHandler ) {
u .handlers [UpdatePeerBlockedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePeerBlocked ))
}
}
type ChannelUserTypingHandler func (ctx context .Context , e Entities , update *UpdateChannelUserTyping ) error
func (u UpdateDispatcher ) OnChannelUserTyping (handler ChannelUserTypingHandler ) {
u .handlers [UpdateChannelUserTypingTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelUserTyping ))
}
}
type PinnedMessagesHandler func (ctx context .Context , e Entities , update *UpdatePinnedMessages ) error
func (u UpdateDispatcher ) OnPinnedMessages (handler PinnedMessagesHandler ) {
u .handlers [UpdatePinnedMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePinnedMessages ))
}
}
type PinnedChannelMessagesHandler func (ctx context .Context , e Entities , update *UpdatePinnedChannelMessages ) error
func (u UpdateDispatcher ) OnPinnedChannelMessages (handler PinnedChannelMessagesHandler ) {
u .handlers [UpdatePinnedChannelMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePinnedChannelMessages ))
}
}
type ChatHandler func (ctx context .Context , e Entities , update *UpdateChat ) error
func (u UpdateDispatcher ) OnChat (handler ChatHandler ) {
u .handlers [UpdateChatTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChat ))
}
}
type GroupCallParticipantsHandler func (ctx context .Context , e Entities , update *UpdateGroupCallParticipants ) error
func (u UpdateDispatcher ) OnGroupCallParticipants (handler GroupCallParticipantsHandler ) {
u .handlers [UpdateGroupCallParticipantsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateGroupCallParticipants ))
}
}
type GroupCallHandler func (ctx context .Context , e Entities , update *UpdateGroupCall ) error
func (u UpdateDispatcher ) OnGroupCall (handler GroupCallHandler ) {
u .handlers [UpdateGroupCallTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateGroupCall ))
}
}
type PeerHistoryTTLHandler func (ctx context .Context , e Entities , update *UpdatePeerHistoryTTL ) error
func (u UpdateDispatcher ) OnPeerHistoryTTL (handler PeerHistoryTTLHandler ) {
u .handlers [UpdatePeerHistoryTTLTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePeerHistoryTTL ))
}
}
type ChatParticipantHandler func (ctx context .Context , e Entities , update *UpdateChatParticipant ) error
func (u UpdateDispatcher ) OnChatParticipant (handler ChatParticipantHandler ) {
u .handlers [UpdateChatParticipantTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChatParticipant ))
}
}
type ChannelParticipantHandler func (ctx context .Context , e Entities , update *UpdateChannelParticipant ) error
func (u UpdateDispatcher ) OnChannelParticipant (handler ChannelParticipantHandler ) {
u .handlers [UpdateChannelParticipantTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelParticipant ))
}
}
type BotStoppedHandler func (ctx context .Context , e Entities , update *UpdateBotStopped ) error
func (u UpdateDispatcher ) OnBotStopped (handler BotStoppedHandler ) {
u .handlers [UpdateBotStoppedTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotStopped ))
}
}
type GroupCallConnectionHandler func (ctx context .Context , e Entities , update *UpdateGroupCallConnection ) error
func (u UpdateDispatcher ) OnGroupCallConnection (handler GroupCallConnectionHandler ) {
u .handlers [UpdateGroupCallConnectionTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateGroupCallConnection ))
}
}
type BotCommandsHandler func (ctx context .Context , e Entities , update *UpdateBotCommands ) error
func (u UpdateDispatcher ) OnBotCommands (handler BotCommandsHandler ) {
u .handlers [UpdateBotCommandsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotCommands ))
}
}
type PendingJoinRequestsHandler func (ctx context .Context , e Entities , update *UpdatePendingJoinRequests ) error
func (u UpdateDispatcher ) OnPendingJoinRequests (handler PendingJoinRequestsHandler ) {
u .handlers [UpdatePendingJoinRequestsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePendingJoinRequests ))
}
}
type BotChatInviteRequesterHandler func (ctx context .Context , e Entities , update *UpdateBotChatInviteRequester ) error
func (u UpdateDispatcher ) OnBotChatInviteRequester (handler BotChatInviteRequesterHandler ) {
u .handlers [UpdateBotChatInviteRequesterTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotChatInviteRequester ))
}
}
type MessageReactionsHandler func (ctx context .Context , e Entities , update *UpdateMessageReactions ) error
func (u UpdateDispatcher ) OnMessageReactions (handler MessageReactionsHandler ) {
u .handlers [UpdateMessageReactionsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMessageReactions ))
}
}
type AttachMenuBotsHandler func (ctx context .Context , e Entities , update *UpdateAttachMenuBots ) error
func (u UpdateDispatcher ) OnAttachMenuBots (handler AttachMenuBotsHandler ) {
u .handlers [UpdateAttachMenuBotsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateAttachMenuBots ))
}
}
type WebViewResultSentHandler func (ctx context .Context , e Entities , update *UpdateWebViewResultSent ) error
func (u UpdateDispatcher ) OnWebViewResultSent (handler WebViewResultSentHandler ) {
u .handlers [UpdateWebViewResultSentTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateWebViewResultSent ))
}
}
type BotMenuButtonHandler func (ctx context .Context , e Entities , update *UpdateBotMenuButton ) error
func (u UpdateDispatcher ) OnBotMenuButton (handler BotMenuButtonHandler ) {
u .handlers [UpdateBotMenuButtonTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotMenuButton ))
}
}
type SavedRingtonesHandler func (ctx context .Context , e Entities , update *UpdateSavedRingtones ) error
func (u UpdateDispatcher ) OnSavedRingtones (handler SavedRingtonesHandler ) {
u .handlers [UpdateSavedRingtonesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateSavedRingtones ))
}
}
type TranscribedAudioHandler func (ctx context .Context , e Entities , update *UpdateTranscribedAudio ) error
func (u UpdateDispatcher ) OnTranscribedAudio (handler TranscribedAudioHandler ) {
u .handlers [UpdateTranscribedAudioTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateTranscribedAudio ))
}
}
type ReadFeaturedEmojiStickersHandler func (ctx context .Context , e Entities , update *UpdateReadFeaturedEmojiStickers ) error
func (u UpdateDispatcher ) OnReadFeaturedEmojiStickers (handler ReadFeaturedEmojiStickersHandler ) {
u .handlers [UpdateReadFeaturedEmojiStickersTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadFeaturedEmojiStickers ))
}
}
type UserEmojiStatusHandler func (ctx context .Context , e Entities , update *UpdateUserEmojiStatus ) error
func (u UpdateDispatcher ) OnUserEmojiStatus (handler UserEmojiStatusHandler ) {
u .handlers [UpdateUserEmojiStatusTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUserEmojiStatus ))
}
}
type RecentEmojiStatusesHandler func (ctx context .Context , e Entities , update *UpdateRecentEmojiStatuses ) error
func (u UpdateDispatcher ) OnRecentEmojiStatuses (handler RecentEmojiStatusesHandler ) {
u .handlers [UpdateRecentEmojiStatusesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateRecentEmojiStatuses ))
}
}
type RecentReactionsHandler func (ctx context .Context , e Entities , update *UpdateRecentReactions ) error
func (u UpdateDispatcher ) OnRecentReactions (handler RecentReactionsHandler ) {
u .handlers [UpdateRecentReactionsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateRecentReactions ))
}
}
type MoveStickerSetToTopHandler func (ctx context .Context , e Entities , update *UpdateMoveStickerSetToTop ) error
func (u UpdateDispatcher ) OnMoveStickerSetToTop (handler MoveStickerSetToTopHandler ) {
u .handlers [UpdateMoveStickerSetToTopTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMoveStickerSetToTop ))
}
}
type MessageExtendedMediaHandler func (ctx context .Context , e Entities , update *UpdateMessageExtendedMedia ) error
func (u UpdateDispatcher ) OnMessageExtendedMedia (handler MessageExtendedMediaHandler ) {
u .handlers [UpdateMessageExtendedMediaTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateMessageExtendedMedia ))
}
}
type ChannelPinnedTopicHandler func (ctx context .Context , e Entities , update *UpdateChannelPinnedTopic ) error
func (u UpdateDispatcher ) OnChannelPinnedTopic (handler ChannelPinnedTopicHandler ) {
u .handlers [UpdateChannelPinnedTopicTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelPinnedTopic ))
}
}
type ChannelPinnedTopicsHandler func (ctx context .Context , e Entities , update *UpdateChannelPinnedTopics ) error
func (u UpdateDispatcher ) OnChannelPinnedTopics (handler ChannelPinnedTopicsHandler ) {
u .handlers [UpdateChannelPinnedTopicsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelPinnedTopics ))
}
}
type UserHandler func (ctx context .Context , e Entities , update *UpdateUser ) error
func (u UpdateDispatcher ) OnUser (handler UserHandler ) {
u .handlers [UpdateUserTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateUser ))
}
}
type AutoSaveSettingsHandler func (ctx context .Context , e Entities , update *UpdateAutoSaveSettings ) error
func (u UpdateDispatcher ) OnAutoSaveSettings (handler AutoSaveSettingsHandler ) {
u .handlers [UpdateAutoSaveSettingsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateAutoSaveSettings ))
}
}
type GroupInvitePrivacyForbiddenHandler func (ctx context .Context , e Entities , update *UpdateGroupInvitePrivacyForbidden ) error
func (u UpdateDispatcher ) OnGroupInvitePrivacyForbidden (handler GroupInvitePrivacyForbiddenHandler ) {
u .handlers [UpdateGroupInvitePrivacyForbiddenTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateGroupInvitePrivacyForbidden ))
}
}
type StoryHandler func (ctx context .Context , e Entities , update *UpdateStory ) error
func (u UpdateDispatcher ) OnStory (handler StoryHandler ) {
u .handlers [UpdateStoryTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateStory ))
}
}
type ReadStoriesHandler func (ctx context .Context , e Entities , update *UpdateReadStories ) error
func (u UpdateDispatcher ) OnReadStories (handler ReadStoriesHandler ) {
u .handlers [UpdateReadStoriesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateReadStories ))
}
}
type StoryIDHandler func (ctx context .Context , e Entities , update *UpdateStoryID ) error
func (u UpdateDispatcher ) OnStoryID (handler StoryIDHandler ) {
u .handlers [UpdateStoryIDTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateStoryID ))
}
}
type StoriesStealthModeHandler func (ctx context .Context , e Entities , update *UpdateStoriesStealthMode ) error
func (u UpdateDispatcher ) OnStoriesStealthMode (handler StoriesStealthModeHandler ) {
u .handlers [UpdateStoriesStealthModeTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateStoriesStealthMode ))
}
}
type SentStoryReactionHandler func (ctx context .Context , e Entities , update *UpdateSentStoryReaction ) error
func (u UpdateDispatcher ) OnSentStoryReaction (handler SentStoryReactionHandler ) {
u .handlers [UpdateSentStoryReactionTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateSentStoryReaction ))
}
}
type BotChatBoostHandler func (ctx context .Context , e Entities , update *UpdateBotChatBoost ) error
func (u UpdateDispatcher ) OnBotChatBoost (handler BotChatBoostHandler ) {
u .handlers [UpdateBotChatBoostTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotChatBoost ))
}
}
type ChannelViewForumAsMessagesHandler func (ctx context .Context , e Entities , update *UpdateChannelViewForumAsMessages ) error
func (u UpdateDispatcher ) OnChannelViewForumAsMessages (handler ChannelViewForumAsMessagesHandler ) {
u .handlers [UpdateChannelViewForumAsMessagesTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateChannelViewForumAsMessages ))
}
}
type PeerWallpaperHandler func (ctx context .Context , e Entities , update *UpdatePeerWallpaper ) error
func (u UpdateDispatcher ) OnPeerWallpaper (handler PeerWallpaperHandler ) {
u .handlers [UpdatePeerWallpaperTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdatePeerWallpaper ))
}
}
type BotMessageReactionHandler func (ctx context .Context , e Entities , update *UpdateBotMessageReaction ) error
func (u UpdateDispatcher ) OnBotMessageReaction (handler BotMessageReactionHandler ) {
u .handlers [UpdateBotMessageReactionTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotMessageReaction ))
}
}
type BotMessageReactionsHandler func (ctx context .Context , e Entities , update *UpdateBotMessageReactions ) error
func (u UpdateDispatcher ) OnBotMessageReactions (handler BotMessageReactionsHandler ) {
u .handlers [UpdateBotMessageReactionsTypeID ] = func (ctx context .Context , e Entities , update UpdateClass ) error {
return handler (ctx , e , update .(*UpdateBotMessageReactions ))
}
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .