You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1067 lines
46 KiB
1067 lines
46 KiB
// Code generated by gotdgen, DO NOT EDIT. |
|
|
|
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" |
|
) |
|
|
|
// No-op definition for keeping imports. |
|
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) |
|
} |
|
|
|
// Handle implements UpdateDispatcher. |
|
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: |
|
// *UpdateShortMessage |
|
// *UpdateShortChatMessage |
|
// *UpdateShortSentMessage |
|
// *UpdatesTooLong |
|
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) |
|
} |
|
|
|
// NewMessageHandler is a NewMessage event handler. |
|
type NewMessageHandler func(ctx context.Context, e Entities, update *UpdateNewMessage) error |
|
|
|
// OnNewMessage sets NewMessage handler. |
|
func (u UpdateDispatcher) OnNewMessage(handler NewMessageHandler) { |
|
u.handlers[UpdateNewMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNewMessage)) |
|
} |
|
} |
|
|
|
// MessageIDHandler is a MessageID event handler. |
|
type MessageIDHandler func(ctx context.Context, e Entities, update *UpdateMessageID) error |
|
|
|
// OnMessageID sets MessageID handler. |
|
func (u UpdateDispatcher) OnMessageID(handler MessageIDHandler) { |
|
u.handlers[UpdateMessageIDTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateMessageID)) |
|
} |
|
} |
|
|
|
// DeleteMessagesHandler is a DeleteMessages event handler. |
|
type DeleteMessagesHandler func(ctx context.Context, e Entities, update *UpdateDeleteMessages) error |
|
|
|
// OnDeleteMessages sets DeleteMessages handler. |
|
func (u UpdateDispatcher) OnDeleteMessages(handler DeleteMessagesHandler) { |
|
u.handlers[UpdateDeleteMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDeleteMessages)) |
|
} |
|
} |
|
|
|
// UserTypingHandler is a UserTyping event handler. |
|
type UserTypingHandler func(ctx context.Context, e Entities, update *UpdateUserTyping) error |
|
|
|
// OnUserTyping sets UserTyping handler. |
|
func (u UpdateDispatcher) OnUserTyping(handler UserTypingHandler) { |
|
u.handlers[UpdateUserTypingTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateUserTyping)) |
|
} |
|
} |
|
|
|
// ChatUserTypingHandler is a ChatUserTyping event handler. |
|
type ChatUserTypingHandler func(ctx context.Context, e Entities, update *UpdateChatUserTyping) error |
|
|
|
// OnChatUserTyping sets ChatUserTyping handler. |
|
func (u UpdateDispatcher) OnChatUserTyping(handler ChatUserTypingHandler) { |
|
u.handlers[UpdateChatUserTypingTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatUserTyping)) |
|
} |
|
} |
|
|
|
// ChatParticipantsHandler is a ChatParticipants event handler. |
|
type ChatParticipantsHandler func(ctx context.Context, e Entities, update *UpdateChatParticipants) error |
|
|
|
// OnChatParticipants sets ChatParticipants handler. |
|
func (u UpdateDispatcher) OnChatParticipants(handler ChatParticipantsHandler) { |
|
u.handlers[UpdateChatParticipantsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatParticipants)) |
|
} |
|
} |
|
|
|
// UserStatusHandler is a UserStatus event handler. |
|
type UserStatusHandler func(ctx context.Context, e Entities, update *UpdateUserStatus) error |
|
|
|
// OnUserStatus sets UserStatus handler. |
|
func (u UpdateDispatcher) OnUserStatus(handler UserStatusHandler) { |
|
u.handlers[UpdateUserStatusTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateUserStatus)) |
|
} |
|
} |
|
|
|
// UserNameHandler is a UserName event handler. |
|
type UserNameHandler func(ctx context.Context, e Entities, update *UpdateUserName) error |
|
|
|
// OnUserName sets UserName handler. |
|
func (u UpdateDispatcher) OnUserName(handler UserNameHandler) { |
|
u.handlers[UpdateUserNameTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateUserName)) |
|
} |
|
} |
|
|
|
// UserPhotoHandler is a UserPhoto event handler. |
|
type UserPhotoHandler func(ctx context.Context, e Entities, update *UpdateUserPhoto) error |
|
|
|
// OnUserPhoto sets UserPhoto handler. |
|
func (u UpdateDispatcher) OnUserPhoto(handler UserPhotoHandler) { |
|
u.handlers[UpdateUserPhotoTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateUserPhoto)) |
|
} |
|
} |
|
|
|
// NewEncryptedMessageHandler is a NewEncryptedMessage event handler. |
|
type NewEncryptedMessageHandler func(ctx context.Context, e Entities, update *UpdateNewEncryptedMessage) error |
|
|
|
// OnNewEncryptedMessage sets NewEncryptedMessage handler. |
|
func (u UpdateDispatcher) OnNewEncryptedMessage(handler NewEncryptedMessageHandler) { |
|
u.handlers[UpdateNewEncryptedMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNewEncryptedMessage)) |
|
} |
|
} |
|
|
|
// EncryptedChatTypingHandler is a EncryptedChatTyping event handler. |
|
type EncryptedChatTypingHandler func(ctx context.Context, e Entities, update *UpdateEncryptedChatTyping) error |
|
|
|
// OnEncryptedChatTyping sets EncryptedChatTyping handler. |
|
func (u UpdateDispatcher) OnEncryptedChatTyping(handler EncryptedChatTypingHandler) { |
|
u.handlers[UpdateEncryptedChatTypingTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateEncryptedChatTyping)) |
|
} |
|
} |
|
|
|
// EncryptionHandler is a Encryption event handler. |
|
type EncryptionHandler func(ctx context.Context, e Entities, update *UpdateEncryption) error |
|
|
|
// OnEncryption sets Encryption handler. |
|
func (u UpdateDispatcher) OnEncryption(handler EncryptionHandler) { |
|
u.handlers[UpdateEncryptionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateEncryption)) |
|
} |
|
} |
|
|
|
// EncryptedMessagesReadHandler is a EncryptedMessagesRead event handler. |
|
type EncryptedMessagesReadHandler func(ctx context.Context, e Entities, update *UpdateEncryptedMessagesRead) error |
|
|
|
// OnEncryptedMessagesRead sets EncryptedMessagesRead handler. |
|
func (u UpdateDispatcher) OnEncryptedMessagesRead(handler EncryptedMessagesReadHandler) { |
|
u.handlers[UpdateEncryptedMessagesReadTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateEncryptedMessagesRead)) |
|
} |
|
} |
|
|
|
// ChatParticipantAddHandler is a ChatParticipantAdd event handler. |
|
type ChatParticipantAddHandler func(ctx context.Context, e Entities, update *UpdateChatParticipantAdd) error |
|
|
|
// OnChatParticipantAdd sets ChatParticipantAdd handler. |
|
func (u UpdateDispatcher) OnChatParticipantAdd(handler ChatParticipantAddHandler) { |
|
u.handlers[UpdateChatParticipantAddTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatParticipantAdd)) |
|
} |
|
} |
|
|
|
// ChatParticipantDeleteHandler is a ChatParticipantDelete event handler. |
|
type ChatParticipantDeleteHandler func(ctx context.Context, e Entities, update *UpdateChatParticipantDelete) error |
|
|
|
// OnChatParticipantDelete sets ChatParticipantDelete handler. |
|
func (u UpdateDispatcher) OnChatParticipantDelete(handler ChatParticipantDeleteHandler) { |
|
u.handlers[UpdateChatParticipantDeleteTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatParticipantDelete)) |
|
} |
|
} |
|
|
|
// DCOptionsHandler is a DCOptions event handler. |
|
type DCOptionsHandler func(ctx context.Context, e Entities, update *UpdateDCOptions) error |
|
|
|
// OnDCOptions sets DCOptions handler. |
|
func (u UpdateDispatcher) OnDCOptions(handler DCOptionsHandler) { |
|
u.handlers[UpdateDCOptionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDCOptions)) |
|
} |
|
} |
|
|
|
// NotifySettingsHandler is a NotifySettings event handler. |
|
type NotifySettingsHandler func(ctx context.Context, e Entities, update *UpdateNotifySettings) error |
|
|
|
// OnNotifySettings sets NotifySettings handler. |
|
func (u UpdateDispatcher) OnNotifySettings(handler NotifySettingsHandler) { |
|
u.handlers[UpdateNotifySettingsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNotifySettings)) |
|
} |
|
} |
|
|
|
// ServiceNotificationHandler is a ServiceNotification event handler. |
|
type ServiceNotificationHandler func(ctx context.Context, e Entities, update *UpdateServiceNotification) error |
|
|
|
// OnServiceNotification sets ServiceNotification handler. |
|
func (u UpdateDispatcher) OnServiceNotification(handler ServiceNotificationHandler) { |
|
u.handlers[UpdateServiceNotificationTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateServiceNotification)) |
|
} |
|
} |
|
|
|
// PrivacyHandler is a Privacy event handler. |
|
type PrivacyHandler func(ctx context.Context, e Entities, update *UpdatePrivacy) error |
|
|
|
// OnPrivacy sets Privacy handler. |
|
func (u UpdateDispatcher) OnPrivacy(handler PrivacyHandler) { |
|
u.handlers[UpdatePrivacyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePrivacy)) |
|
} |
|
} |
|
|
|
// UserPhoneHandler is a UserPhone event handler. |
|
type UserPhoneHandler func(ctx context.Context, e Entities, update *UpdateUserPhone) error |
|
|
|
// OnUserPhone sets UserPhone handler. |
|
func (u UpdateDispatcher) OnUserPhone(handler UserPhoneHandler) { |
|
u.handlers[UpdateUserPhoneTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateUserPhone)) |
|
} |
|
} |
|
|
|
// ReadHistoryInboxHandler is a ReadHistoryInbox event handler. |
|
type ReadHistoryInboxHandler func(ctx context.Context, e Entities, update *UpdateReadHistoryInbox) error |
|
|
|
// OnReadHistoryInbox sets ReadHistoryInbox handler. |
|
func (u UpdateDispatcher) OnReadHistoryInbox(handler ReadHistoryInboxHandler) { |
|
u.handlers[UpdateReadHistoryInboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadHistoryInbox)) |
|
} |
|
} |
|
|
|
// ReadHistoryOutboxHandler is a ReadHistoryOutbox event handler. |
|
type ReadHistoryOutboxHandler func(ctx context.Context, e Entities, update *UpdateReadHistoryOutbox) error |
|
|
|
// OnReadHistoryOutbox sets ReadHistoryOutbox handler. |
|
func (u UpdateDispatcher) OnReadHistoryOutbox(handler ReadHistoryOutboxHandler) { |
|
u.handlers[UpdateReadHistoryOutboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadHistoryOutbox)) |
|
} |
|
} |
|
|
|
// WebPageHandler is a WebPage event handler. |
|
type WebPageHandler func(ctx context.Context, e Entities, update *UpdateWebPage) error |
|
|
|
// OnWebPage sets WebPage handler. |
|
func (u UpdateDispatcher) OnWebPage(handler WebPageHandler) { |
|
u.handlers[UpdateWebPageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateWebPage)) |
|
} |
|
} |
|
|
|
// ReadMessagesContentsHandler is a ReadMessagesContents event handler. |
|
type ReadMessagesContentsHandler func(ctx context.Context, e Entities, update *UpdateReadMessagesContents) error |
|
|
|
// OnReadMessagesContents sets ReadMessagesContents handler. |
|
func (u UpdateDispatcher) OnReadMessagesContents(handler ReadMessagesContentsHandler) { |
|
u.handlers[UpdateReadMessagesContentsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadMessagesContents)) |
|
} |
|
} |
|
|
|
// ChannelTooLongHandler is a ChannelTooLong event handler. |
|
type ChannelTooLongHandler func(ctx context.Context, e Entities, update *UpdateChannelTooLong) error |
|
|
|
// OnChannelTooLong sets ChannelTooLong handler. |
|
func (u UpdateDispatcher) OnChannelTooLong(handler ChannelTooLongHandler) { |
|
u.handlers[UpdateChannelTooLongTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelTooLong)) |
|
} |
|
} |
|
|
|
// ChannelHandler is a Channel event handler. |
|
type ChannelHandler func(ctx context.Context, e Entities, update *UpdateChannel) error |
|
|
|
// OnChannel sets Channel handler. |
|
func (u UpdateDispatcher) OnChannel(handler ChannelHandler) { |
|
u.handlers[UpdateChannelTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannel)) |
|
} |
|
} |
|
|
|
// NewChannelMessageHandler is a NewChannelMessage event handler. |
|
type NewChannelMessageHandler func(ctx context.Context, e Entities, update *UpdateNewChannelMessage) error |
|
|
|
// OnNewChannelMessage sets NewChannelMessage handler. |
|
func (u UpdateDispatcher) OnNewChannelMessage(handler NewChannelMessageHandler) { |
|
u.handlers[UpdateNewChannelMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNewChannelMessage)) |
|
} |
|
} |
|
|
|
// ReadChannelInboxHandler is a ReadChannelInbox event handler. |
|
type ReadChannelInboxHandler func(ctx context.Context, e Entities, update *UpdateReadChannelInbox) error |
|
|
|
// OnReadChannelInbox sets ReadChannelInbox handler. |
|
func (u UpdateDispatcher) OnReadChannelInbox(handler ReadChannelInboxHandler) { |
|
u.handlers[UpdateReadChannelInboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadChannelInbox)) |
|
} |
|
} |
|
|
|
// DeleteChannelMessagesHandler is a DeleteChannelMessages event handler. |
|
type DeleteChannelMessagesHandler func(ctx context.Context, e Entities, update *UpdateDeleteChannelMessages) error |
|
|
|
// OnDeleteChannelMessages sets DeleteChannelMessages handler. |
|
func (u UpdateDispatcher) OnDeleteChannelMessages(handler DeleteChannelMessagesHandler) { |
|
u.handlers[UpdateDeleteChannelMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDeleteChannelMessages)) |
|
} |
|
} |
|
|
|
// ChannelMessageViewsHandler is a ChannelMessageViews event handler. |
|
type ChannelMessageViewsHandler func(ctx context.Context, e Entities, update *UpdateChannelMessageViews) error |
|
|
|
// OnChannelMessageViews sets ChannelMessageViews handler. |
|
func (u UpdateDispatcher) OnChannelMessageViews(handler ChannelMessageViewsHandler) { |
|
u.handlers[UpdateChannelMessageViewsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelMessageViews)) |
|
} |
|
} |
|
|
|
// ChatParticipantAdminHandler is a ChatParticipantAdmin event handler. |
|
type ChatParticipantAdminHandler func(ctx context.Context, e Entities, update *UpdateChatParticipantAdmin) error |
|
|
|
// OnChatParticipantAdmin sets ChatParticipantAdmin handler. |
|
func (u UpdateDispatcher) OnChatParticipantAdmin(handler ChatParticipantAdminHandler) { |
|
u.handlers[UpdateChatParticipantAdminTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatParticipantAdmin)) |
|
} |
|
} |
|
|
|
// NewStickerSetHandler is a NewStickerSet event handler. |
|
type NewStickerSetHandler func(ctx context.Context, e Entities, update *UpdateNewStickerSet) error |
|
|
|
// OnNewStickerSet sets NewStickerSet handler. |
|
func (u UpdateDispatcher) OnNewStickerSet(handler NewStickerSetHandler) { |
|
u.handlers[UpdateNewStickerSetTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNewStickerSet)) |
|
} |
|
} |
|
|
|
// StickerSetsOrderHandler is a StickerSetsOrder event handler. |
|
type StickerSetsOrderHandler func(ctx context.Context, e Entities, update *UpdateStickerSetsOrder) error |
|
|
|
// OnStickerSetsOrder sets StickerSetsOrder handler. |
|
func (u UpdateDispatcher) OnStickerSetsOrder(handler StickerSetsOrderHandler) { |
|
u.handlers[UpdateStickerSetsOrderTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateStickerSetsOrder)) |
|
} |
|
} |
|
|
|
// StickerSetsHandler is a StickerSets event handler. |
|
type StickerSetsHandler func(ctx context.Context, e Entities, update *UpdateStickerSets) error |
|
|
|
// OnStickerSets sets StickerSets handler. |
|
func (u UpdateDispatcher) OnStickerSets(handler StickerSetsHandler) { |
|
u.handlers[UpdateStickerSetsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateStickerSets)) |
|
} |
|
} |
|
|
|
// SavedGifsHandler is a SavedGifs event handler. |
|
type SavedGifsHandler func(ctx context.Context, e Entities, update *UpdateSavedGifs) error |
|
|
|
// OnSavedGifs sets SavedGifs handler. |
|
func (u UpdateDispatcher) OnSavedGifs(handler SavedGifsHandler) { |
|
u.handlers[UpdateSavedGifsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateSavedGifs)) |
|
} |
|
} |
|
|
|
// BotInlineQueryHandler is a BotInlineQuery event handler. |
|
type BotInlineQueryHandler func(ctx context.Context, e Entities, update *UpdateBotInlineQuery) error |
|
|
|
// OnBotInlineQuery sets BotInlineQuery handler. |
|
func (u UpdateDispatcher) OnBotInlineQuery(handler BotInlineQueryHandler) { |
|
u.handlers[UpdateBotInlineQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotInlineQuery)) |
|
} |
|
} |
|
|
|
// BotInlineSendHandler is a BotInlineSend event handler. |
|
type BotInlineSendHandler func(ctx context.Context, e Entities, update *UpdateBotInlineSend) error |
|
|
|
// OnBotInlineSend sets BotInlineSend handler. |
|
func (u UpdateDispatcher) OnBotInlineSend(handler BotInlineSendHandler) { |
|
u.handlers[UpdateBotInlineSendTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotInlineSend)) |
|
} |
|
} |
|
|
|
// EditChannelMessageHandler is a EditChannelMessage event handler. |
|
type EditChannelMessageHandler func(ctx context.Context, e Entities, update *UpdateEditChannelMessage) error |
|
|
|
// OnEditChannelMessage sets EditChannelMessage handler. |
|
func (u UpdateDispatcher) OnEditChannelMessage(handler EditChannelMessageHandler) { |
|
u.handlers[UpdateEditChannelMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateEditChannelMessage)) |
|
} |
|
} |
|
|
|
// BotCallbackQueryHandler is a BotCallbackQuery event handler. |
|
type BotCallbackQueryHandler func(ctx context.Context, e Entities, update *UpdateBotCallbackQuery) error |
|
|
|
// OnBotCallbackQuery sets BotCallbackQuery handler. |
|
func (u UpdateDispatcher) OnBotCallbackQuery(handler BotCallbackQueryHandler) { |
|
u.handlers[UpdateBotCallbackQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotCallbackQuery)) |
|
} |
|
} |
|
|
|
// EditMessageHandler is a EditMessage event handler. |
|
type EditMessageHandler func(ctx context.Context, e Entities, update *UpdateEditMessage) error |
|
|
|
// OnEditMessage sets EditMessage handler. |
|
func (u UpdateDispatcher) OnEditMessage(handler EditMessageHandler) { |
|
u.handlers[UpdateEditMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateEditMessage)) |
|
} |
|
} |
|
|
|
// InlineBotCallbackQueryHandler is a InlineBotCallbackQuery event handler. |
|
type InlineBotCallbackQueryHandler func(ctx context.Context, e Entities, update *UpdateInlineBotCallbackQuery) error |
|
|
|
// OnInlineBotCallbackQuery sets InlineBotCallbackQuery handler. |
|
func (u UpdateDispatcher) OnInlineBotCallbackQuery(handler InlineBotCallbackQueryHandler) { |
|
u.handlers[UpdateInlineBotCallbackQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateInlineBotCallbackQuery)) |
|
} |
|
} |
|
|
|
// ReadChannelOutboxHandler is a ReadChannelOutbox event handler. |
|
type ReadChannelOutboxHandler func(ctx context.Context, e Entities, update *UpdateReadChannelOutbox) error |
|
|
|
// OnReadChannelOutbox sets ReadChannelOutbox handler. |
|
func (u UpdateDispatcher) OnReadChannelOutbox(handler ReadChannelOutboxHandler) { |
|
u.handlers[UpdateReadChannelOutboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadChannelOutbox)) |
|
} |
|
} |
|
|
|
// DraftMessageHandler is a DraftMessage event handler. |
|
type DraftMessageHandler func(ctx context.Context, e Entities, update *UpdateDraftMessage) error |
|
|
|
// OnDraftMessage sets DraftMessage handler. |
|
func (u UpdateDispatcher) OnDraftMessage(handler DraftMessageHandler) { |
|
u.handlers[UpdateDraftMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDraftMessage)) |
|
} |
|
} |
|
|
|
// ReadFeaturedStickersHandler is a ReadFeaturedStickers event handler. |
|
type ReadFeaturedStickersHandler func(ctx context.Context, e Entities, update *UpdateReadFeaturedStickers) error |
|
|
|
// OnReadFeaturedStickers sets ReadFeaturedStickers handler. |
|
func (u UpdateDispatcher) OnReadFeaturedStickers(handler ReadFeaturedStickersHandler) { |
|
u.handlers[UpdateReadFeaturedStickersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadFeaturedStickers)) |
|
} |
|
} |
|
|
|
// RecentStickersHandler is a RecentStickers event handler. |
|
type RecentStickersHandler func(ctx context.Context, e Entities, update *UpdateRecentStickers) error |
|
|
|
// OnRecentStickers sets RecentStickers handler. |
|
func (u UpdateDispatcher) OnRecentStickers(handler RecentStickersHandler) { |
|
u.handlers[UpdateRecentStickersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateRecentStickers)) |
|
} |
|
} |
|
|
|
// ConfigHandler is a Config event handler. |
|
type ConfigHandler func(ctx context.Context, e Entities, update *UpdateConfig) error |
|
|
|
// OnConfig sets Config handler. |
|
func (u UpdateDispatcher) OnConfig(handler ConfigHandler) { |
|
u.handlers[UpdateConfigTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateConfig)) |
|
} |
|
} |
|
|
|
// PtsChangedHandler is a PtsChanged event handler. |
|
type PtsChangedHandler func(ctx context.Context, e Entities, update *UpdatePtsChanged) error |
|
|
|
// OnPtsChanged sets PtsChanged handler. |
|
func (u UpdateDispatcher) OnPtsChanged(handler PtsChangedHandler) { |
|
u.handlers[UpdatePtsChangedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePtsChanged)) |
|
} |
|
} |
|
|
|
// ChannelWebPageHandler is a ChannelWebPage event handler. |
|
type ChannelWebPageHandler func(ctx context.Context, e Entities, update *UpdateChannelWebPage) error |
|
|
|
// OnChannelWebPage sets ChannelWebPage handler. |
|
func (u UpdateDispatcher) OnChannelWebPage(handler ChannelWebPageHandler) { |
|
u.handlers[UpdateChannelWebPageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelWebPage)) |
|
} |
|
} |
|
|
|
// DialogPinnedHandler is a DialogPinned event handler. |
|
type DialogPinnedHandler func(ctx context.Context, e Entities, update *UpdateDialogPinned) error |
|
|
|
// OnDialogPinned sets DialogPinned handler. |
|
func (u UpdateDispatcher) OnDialogPinned(handler DialogPinnedHandler) { |
|
u.handlers[UpdateDialogPinnedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDialogPinned)) |
|
} |
|
} |
|
|
|
// PinnedDialogsHandler is a PinnedDialogs event handler. |
|
type PinnedDialogsHandler func(ctx context.Context, e Entities, update *UpdatePinnedDialogs) error |
|
|
|
// OnPinnedDialogs sets PinnedDialogs handler. |
|
func (u UpdateDispatcher) OnPinnedDialogs(handler PinnedDialogsHandler) { |
|
u.handlers[UpdatePinnedDialogsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePinnedDialogs)) |
|
} |
|
} |
|
|
|
// BotWebhookJSONHandler is a BotWebhookJSON event handler. |
|
type BotWebhookJSONHandler func(ctx context.Context, e Entities, update *UpdateBotWebhookJSON) error |
|
|
|
// OnBotWebhookJSON sets BotWebhookJSON handler. |
|
func (u UpdateDispatcher) OnBotWebhookJSON(handler BotWebhookJSONHandler) { |
|
u.handlers[UpdateBotWebhookJSONTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotWebhookJSON)) |
|
} |
|
} |
|
|
|
// BotWebhookJSONQueryHandler is a BotWebhookJSONQuery event handler. |
|
type BotWebhookJSONQueryHandler func(ctx context.Context, e Entities, update *UpdateBotWebhookJSONQuery) error |
|
|
|
// OnBotWebhookJSONQuery sets BotWebhookJSONQuery handler. |
|
func (u UpdateDispatcher) OnBotWebhookJSONQuery(handler BotWebhookJSONQueryHandler) { |
|
u.handlers[UpdateBotWebhookJSONQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotWebhookJSONQuery)) |
|
} |
|
} |
|
|
|
// BotShippingQueryHandler is a BotShippingQuery event handler. |
|
type BotShippingQueryHandler func(ctx context.Context, e Entities, update *UpdateBotShippingQuery) error |
|
|
|
// OnBotShippingQuery sets BotShippingQuery handler. |
|
func (u UpdateDispatcher) OnBotShippingQuery(handler BotShippingQueryHandler) { |
|
u.handlers[UpdateBotShippingQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotShippingQuery)) |
|
} |
|
} |
|
|
|
// BotPrecheckoutQueryHandler is a BotPrecheckoutQuery event handler. |
|
type BotPrecheckoutQueryHandler func(ctx context.Context, e Entities, update *UpdateBotPrecheckoutQuery) error |
|
|
|
// OnBotPrecheckoutQuery sets BotPrecheckoutQuery handler. |
|
func (u UpdateDispatcher) OnBotPrecheckoutQuery(handler BotPrecheckoutQueryHandler) { |
|
u.handlers[UpdateBotPrecheckoutQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotPrecheckoutQuery)) |
|
} |
|
} |
|
|
|
// PhoneCallHandler is a PhoneCall event handler. |
|
type PhoneCallHandler func(ctx context.Context, e Entities, update *UpdatePhoneCall) error |
|
|
|
// OnPhoneCall sets PhoneCall handler. |
|
func (u UpdateDispatcher) OnPhoneCall(handler PhoneCallHandler) { |
|
u.handlers[UpdatePhoneCallTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePhoneCall)) |
|
} |
|
} |
|
|
|
// LangPackTooLongHandler is a LangPackTooLong event handler. |
|
type LangPackTooLongHandler func(ctx context.Context, e Entities, update *UpdateLangPackTooLong) error |
|
|
|
// OnLangPackTooLong sets LangPackTooLong handler. |
|
func (u UpdateDispatcher) OnLangPackTooLong(handler LangPackTooLongHandler) { |
|
u.handlers[UpdateLangPackTooLongTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateLangPackTooLong)) |
|
} |
|
} |
|
|
|
// LangPackHandler is a LangPack event handler. |
|
type LangPackHandler func(ctx context.Context, e Entities, update *UpdateLangPack) error |
|
|
|
// OnLangPack sets LangPack handler. |
|
func (u UpdateDispatcher) OnLangPack(handler LangPackHandler) { |
|
u.handlers[UpdateLangPackTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateLangPack)) |
|
} |
|
} |
|
|
|
// FavedStickersHandler is a FavedStickers event handler. |
|
type FavedStickersHandler func(ctx context.Context, e Entities, update *UpdateFavedStickers) error |
|
|
|
// OnFavedStickers sets FavedStickers handler. |
|
func (u UpdateDispatcher) OnFavedStickers(handler FavedStickersHandler) { |
|
u.handlers[UpdateFavedStickersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateFavedStickers)) |
|
} |
|
} |
|
|
|
// ChannelReadMessagesContentsHandler is a ChannelReadMessagesContents event handler. |
|
type ChannelReadMessagesContentsHandler func(ctx context.Context, e Entities, update *UpdateChannelReadMessagesContents) error |
|
|
|
// OnChannelReadMessagesContents sets ChannelReadMessagesContents handler. |
|
func (u UpdateDispatcher) OnChannelReadMessagesContents(handler ChannelReadMessagesContentsHandler) { |
|
u.handlers[UpdateChannelReadMessagesContentsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelReadMessagesContents)) |
|
} |
|
} |
|
|
|
// ContactsResetHandler is a ContactsReset event handler. |
|
type ContactsResetHandler func(ctx context.Context, e Entities, update *UpdateContactsReset) error |
|
|
|
// OnContactsReset sets ContactsReset handler. |
|
func (u UpdateDispatcher) OnContactsReset(handler ContactsResetHandler) { |
|
u.handlers[UpdateContactsResetTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateContactsReset)) |
|
} |
|
} |
|
|
|
// ChannelAvailableMessagesHandler is a ChannelAvailableMessages event handler. |
|
type ChannelAvailableMessagesHandler func(ctx context.Context, e Entities, update *UpdateChannelAvailableMessages) error |
|
|
|
// OnChannelAvailableMessages sets ChannelAvailableMessages handler. |
|
func (u UpdateDispatcher) OnChannelAvailableMessages(handler ChannelAvailableMessagesHandler) { |
|
u.handlers[UpdateChannelAvailableMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelAvailableMessages)) |
|
} |
|
} |
|
|
|
// DialogUnreadMarkHandler is a DialogUnreadMark event handler. |
|
type DialogUnreadMarkHandler func(ctx context.Context, e Entities, update *UpdateDialogUnreadMark) error |
|
|
|
// OnDialogUnreadMark sets DialogUnreadMark handler. |
|
func (u UpdateDispatcher) OnDialogUnreadMark(handler DialogUnreadMarkHandler) { |
|
u.handlers[UpdateDialogUnreadMarkTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDialogUnreadMark)) |
|
} |
|
} |
|
|
|
// MessagePollHandler is a MessagePoll event handler. |
|
type MessagePollHandler func(ctx context.Context, e Entities, update *UpdateMessagePoll) error |
|
|
|
// OnMessagePoll sets MessagePoll handler. |
|
func (u UpdateDispatcher) OnMessagePoll(handler MessagePollHandler) { |
|
u.handlers[UpdateMessagePollTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateMessagePoll)) |
|
} |
|
} |
|
|
|
// ChatDefaultBannedRightsHandler is a ChatDefaultBannedRights event handler. |
|
type ChatDefaultBannedRightsHandler func(ctx context.Context, e Entities, update *UpdateChatDefaultBannedRights) error |
|
|
|
// OnChatDefaultBannedRights sets ChatDefaultBannedRights handler. |
|
func (u UpdateDispatcher) OnChatDefaultBannedRights(handler ChatDefaultBannedRightsHandler) { |
|
u.handlers[UpdateChatDefaultBannedRightsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatDefaultBannedRights)) |
|
} |
|
} |
|
|
|
// FolderPeersHandler is a FolderPeers event handler. |
|
type FolderPeersHandler func(ctx context.Context, e Entities, update *UpdateFolderPeers) error |
|
|
|
// OnFolderPeers sets FolderPeers handler. |
|
func (u UpdateDispatcher) OnFolderPeers(handler FolderPeersHandler) { |
|
u.handlers[UpdateFolderPeersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateFolderPeers)) |
|
} |
|
} |
|
|
|
// PeerSettingsHandler is a PeerSettings event handler. |
|
type PeerSettingsHandler func(ctx context.Context, e Entities, update *UpdatePeerSettings) error |
|
|
|
// OnPeerSettings sets PeerSettings handler. |
|
func (u UpdateDispatcher) OnPeerSettings(handler PeerSettingsHandler) { |
|
u.handlers[UpdatePeerSettingsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePeerSettings)) |
|
} |
|
} |
|
|
|
// PeerLocatedHandler is a PeerLocated event handler. |
|
type PeerLocatedHandler func(ctx context.Context, e Entities, update *UpdatePeerLocated) error |
|
|
|
// OnPeerLocated sets PeerLocated handler. |
|
func (u UpdateDispatcher) OnPeerLocated(handler PeerLocatedHandler) { |
|
u.handlers[UpdatePeerLocatedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePeerLocated)) |
|
} |
|
} |
|
|
|
// NewScheduledMessageHandler is a NewScheduledMessage event handler. |
|
type NewScheduledMessageHandler func(ctx context.Context, e Entities, update *UpdateNewScheduledMessage) error |
|
|
|
// OnNewScheduledMessage sets NewScheduledMessage handler. |
|
func (u UpdateDispatcher) OnNewScheduledMessage(handler NewScheduledMessageHandler) { |
|
u.handlers[UpdateNewScheduledMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateNewScheduledMessage)) |
|
} |
|
} |
|
|
|
// DeleteScheduledMessagesHandler is a DeleteScheduledMessages event handler. |
|
type DeleteScheduledMessagesHandler func(ctx context.Context, e Entities, update *UpdateDeleteScheduledMessages) error |
|
|
|
// OnDeleteScheduledMessages sets DeleteScheduledMessages handler. |
|
func (u UpdateDispatcher) OnDeleteScheduledMessages(handler DeleteScheduledMessagesHandler) { |
|
u.handlers[UpdateDeleteScheduledMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDeleteScheduledMessages)) |
|
} |
|
} |
|
|
|
// ThemeHandler is a Theme event handler. |
|
type ThemeHandler func(ctx context.Context, e Entities, update *UpdateTheme) error |
|
|
|
// OnTheme sets Theme handler. |
|
func (u UpdateDispatcher) OnTheme(handler ThemeHandler) { |
|
u.handlers[UpdateThemeTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateTheme)) |
|
} |
|
} |
|
|
|
// GeoLiveViewedHandler is a GeoLiveViewed event handler. |
|
type GeoLiveViewedHandler func(ctx context.Context, e Entities, update *UpdateGeoLiveViewed) error |
|
|
|
// OnGeoLiveViewed sets GeoLiveViewed handler. |
|
func (u UpdateDispatcher) OnGeoLiveViewed(handler GeoLiveViewedHandler) { |
|
u.handlers[UpdateGeoLiveViewedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateGeoLiveViewed)) |
|
} |
|
} |
|
|
|
// LoginTokenHandler is a LoginToken event handler. |
|
type LoginTokenHandler func(ctx context.Context, e Entities, update *UpdateLoginToken) error |
|
|
|
// OnLoginToken sets LoginToken handler. |
|
func (u UpdateDispatcher) OnLoginToken(handler LoginTokenHandler) { |
|
u.handlers[UpdateLoginTokenTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateLoginToken)) |
|
} |
|
} |
|
|
|
// MessagePollVoteHandler is a MessagePollVote event handler. |
|
type MessagePollVoteHandler func(ctx context.Context, e Entities, update *UpdateMessagePollVote) error |
|
|
|
// OnMessagePollVote sets MessagePollVote handler. |
|
func (u UpdateDispatcher) OnMessagePollVote(handler MessagePollVoteHandler) { |
|
u.handlers[UpdateMessagePollVoteTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateMessagePollVote)) |
|
} |
|
} |
|
|
|
// DialogFilterHandler is a DialogFilter event handler. |
|
type DialogFilterHandler func(ctx context.Context, e Entities, update *UpdateDialogFilter) error |
|
|
|
// OnDialogFilter sets DialogFilter handler. |
|
func (u UpdateDispatcher) OnDialogFilter(handler DialogFilterHandler) { |
|
u.handlers[UpdateDialogFilterTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDialogFilter)) |
|
} |
|
} |
|
|
|
// DialogFilterOrderHandler is a DialogFilterOrder event handler. |
|
type DialogFilterOrderHandler func(ctx context.Context, e Entities, update *UpdateDialogFilterOrder) error |
|
|
|
// OnDialogFilterOrder sets DialogFilterOrder handler. |
|
func (u UpdateDispatcher) OnDialogFilterOrder(handler DialogFilterOrderHandler) { |
|
u.handlers[UpdateDialogFilterOrderTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDialogFilterOrder)) |
|
} |
|
} |
|
|
|
// DialogFiltersHandler is a DialogFilters event handler. |
|
type DialogFiltersHandler func(ctx context.Context, e Entities, update *UpdateDialogFilters) error |
|
|
|
// OnDialogFilters sets DialogFilters handler. |
|
func (u UpdateDispatcher) OnDialogFilters(handler DialogFiltersHandler) { |
|
u.handlers[UpdateDialogFiltersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateDialogFilters)) |
|
} |
|
} |
|
|
|
// PhoneCallSignalingDataHandler is a PhoneCallSignalingData event handler. |
|
type PhoneCallSignalingDataHandler func(ctx context.Context, e Entities, update *UpdatePhoneCallSignalingData) error |
|
|
|
// OnPhoneCallSignalingData sets PhoneCallSignalingData handler. |
|
func (u UpdateDispatcher) OnPhoneCallSignalingData(handler PhoneCallSignalingDataHandler) { |
|
u.handlers[UpdatePhoneCallSignalingDataTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePhoneCallSignalingData)) |
|
} |
|
} |
|
|
|
// ChannelMessageForwardsHandler is a ChannelMessageForwards event handler. |
|
type ChannelMessageForwardsHandler func(ctx context.Context, e Entities, update *UpdateChannelMessageForwards) error |
|
|
|
// OnChannelMessageForwards sets ChannelMessageForwards handler. |
|
func (u UpdateDispatcher) OnChannelMessageForwards(handler ChannelMessageForwardsHandler) { |
|
u.handlers[UpdateChannelMessageForwardsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelMessageForwards)) |
|
} |
|
} |
|
|
|
// ReadChannelDiscussionInboxHandler is a ReadChannelDiscussionInbox event handler. |
|
type ReadChannelDiscussionInboxHandler func(ctx context.Context, e Entities, update *UpdateReadChannelDiscussionInbox) error |
|
|
|
// OnReadChannelDiscussionInbox sets ReadChannelDiscussionInbox handler. |
|
func (u UpdateDispatcher) OnReadChannelDiscussionInbox(handler ReadChannelDiscussionInboxHandler) { |
|
u.handlers[UpdateReadChannelDiscussionInboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadChannelDiscussionInbox)) |
|
} |
|
} |
|
|
|
// ReadChannelDiscussionOutboxHandler is a ReadChannelDiscussionOutbox event handler. |
|
type ReadChannelDiscussionOutboxHandler func(ctx context.Context, e Entities, update *UpdateReadChannelDiscussionOutbox) error |
|
|
|
// OnReadChannelDiscussionOutbox sets ReadChannelDiscussionOutbox handler. |
|
func (u UpdateDispatcher) OnReadChannelDiscussionOutbox(handler ReadChannelDiscussionOutboxHandler) { |
|
u.handlers[UpdateReadChannelDiscussionOutboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateReadChannelDiscussionOutbox)) |
|
} |
|
} |
|
|
|
// PeerBlockedHandler is a PeerBlocked event handler. |
|
type PeerBlockedHandler func(ctx context.Context, e Entities, update *UpdatePeerBlocked) error |
|
|
|
// OnPeerBlocked sets PeerBlocked handler. |
|
func (u UpdateDispatcher) OnPeerBlocked(handler PeerBlockedHandler) { |
|
u.handlers[UpdatePeerBlockedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePeerBlocked)) |
|
} |
|
} |
|
|
|
// ChannelUserTypingHandler is a ChannelUserTyping event handler. |
|
type ChannelUserTypingHandler func(ctx context.Context, e Entities, update *UpdateChannelUserTyping) error |
|
|
|
// OnChannelUserTyping sets ChannelUserTyping handler. |
|
func (u UpdateDispatcher) OnChannelUserTyping(handler ChannelUserTypingHandler) { |
|
u.handlers[UpdateChannelUserTypingTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelUserTyping)) |
|
} |
|
} |
|
|
|
// PinnedMessagesHandler is a PinnedMessages event handler. |
|
type PinnedMessagesHandler func(ctx context.Context, e Entities, update *UpdatePinnedMessages) error |
|
|
|
// OnPinnedMessages sets PinnedMessages handler. |
|
func (u UpdateDispatcher) OnPinnedMessages(handler PinnedMessagesHandler) { |
|
u.handlers[UpdatePinnedMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePinnedMessages)) |
|
} |
|
} |
|
|
|
// PinnedChannelMessagesHandler is a PinnedChannelMessages event handler. |
|
type PinnedChannelMessagesHandler func(ctx context.Context, e Entities, update *UpdatePinnedChannelMessages) error |
|
|
|
// OnPinnedChannelMessages sets PinnedChannelMessages handler. |
|
func (u UpdateDispatcher) OnPinnedChannelMessages(handler PinnedChannelMessagesHandler) { |
|
u.handlers[UpdatePinnedChannelMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePinnedChannelMessages)) |
|
} |
|
} |
|
|
|
// ChatHandler is a Chat event handler. |
|
type ChatHandler func(ctx context.Context, e Entities, update *UpdateChat) error |
|
|
|
// OnChat sets Chat handler. |
|
func (u UpdateDispatcher) OnChat(handler ChatHandler) { |
|
u.handlers[UpdateChatTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChat)) |
|
} |
|
} |
|
|
|
// GroupCallParticipantsHandler is a GroupCallParticipants event handler. |
|
type GroupCallParticipantsHandler func(ctx context.Context, e Entities, update *UpdateGroupCallParticipants) error |
|
|
|
// OnGroupCallParticipants sets GroupCallParticipants handler. |
|
func (u UpdateDispatcher) OnGroupCallParticipants(handler GroupCallParticipantsHandler) { |
|
u.handlers[UpdateGroupCallParticipantsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateGroupCallParticipants)) |
|
} |
|
} |
|
|
|
// GroupCallHandler is a GroupCall event handler. |
|
type GroupCallHandler func(ctx context.Context, e Entities, update *UpdateGroupCall) error |
|
|
|
// OnGroupCall sets GroupCall handler. |
|
func (u UpdateDispatcher) OnGroupCall(handler GroupCallHandler) { |
|
u.handlers[UpdateGroupCallTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateGroupCall)) |
|
} |
|
} |
|
|
|
// PeerHistoryTTLHandler is a PeerHistoryTTL event handler. |
|
type PeerHistoryTTLHandler func(ctx context.Context, e Entities, update *UpdatePeerHistoryTTL) error |
|
|
|
// OnPeerHistoryTTL sets PeerHistoryTTL handler. |
|
func (u UpdateDispatcher) OnPeerHistoryTTL(handler PeerHistoryTTLHandler) { |
|
u.handlers[UpdatePeerHistoryTTLTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePeerHistoryTTL)) |
|
} |
|
} |
|
|
|
// ChatParticipantHandler is a ChatParticipant event handler. |
|
type ChatParticipantHandler func(ctx context.Context, e Entities, update *UpdateChatParticipant) error |
|
|
|
// OnChatParticipant sets ChatParticipant handler. |
|
func (u UpdateDispatcher) OnChatParticipant(handler ChatParticipantHandler) { |
|
u.handlers[UpdateChatParticipantTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChatParticipant)) |
|
} |
|
} |
|
|
|
// ChannelParticipantHandler is a ChannelParticipant event handler. |
|
type ChannelParticipantHandler func(ctx context.Context, e Entities, update *UpdateChannelParticipant) error |
|
|
|
// OnChannelParticipant sets ChannelParticipant handler. |
|
func (u UpdateDispatcher) OnChannelParticipant(handler ChannelParticipantHandler) { |
|
u.handlers[UpdateChannelParticipantTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateChannelParticipant)) |
|
} |
|
} |
|
|
|
// BotStoppedHandler is a BotStopped event handler. |
|
type BotStoppedHandler func(ctx context.Context, e Entities, update *UpdateBotStopped) error |
|
|
|
// OnBotStopped sets BotStopped handler. |
|
func (u UpdateDispatcher) OnBotStopped(handler BotStoppedHandler) { |
|
u.handlers[UpdateBotStoppedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotStopped)) |
|
} |
|
} |
|
|
|
// GroupCallConnectionHandler is a GroupCallConnection event handler. |
|
type GroupCallConnectionHandler func(ctx context.Context, e Entities, update *UpdateGroupCallConnection) error |
|
|
|
// OnGroupCallConnection sets GroupCallConnection handler. |
|
func (u UpdateDispatcher) OnGroupCallConnection(handler GroupCallConnectionHandler) { |
|
u.handlers[UpdateGroupCallConnectionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateGroupCallConnection)) |
|
} |
|
} |
|
|
|
// BotCommandsHandler is a BotCommands event handler. |
|
type BotCommandsHandler func(ctx context.Context, e Entities, update *UpdateBotCommands) error |
|
|
|
// OnBotCommands sets BotCommands handler. |
|
func (u UpdateDispatcher) OnBotCommands(handler BotCommandsHandler) { |
|
u.handlers[UpdateBotCommandsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotCommands)) |
|
} |
|
} |
|
|
|
// PendingJoinRequestsHandler is a PendingJoinRequests event handler. |
|
type PendingJoinRequestsHandler func(ctx context.Context, e Entities, update *UpdatePendingJoinRequests) error |
|
|
|
// OnPendingJoinRequests sets PendingJoinRequests handler. |
|
func (u UpdateDispatcher) OnPendingJoinRequests(handler PendingJoinRequestsHandler) { |
|
u.handlers[UpdatePendingJoinRequestsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdatePendingJoinRequests)) |
|
} |
|
} |
|
|
|
// BotChatInviteRequesterHandler is a BotChatInviteRequester event handler. |
|
type BotChatInviteRequesterHandler func(ctx context.Context, e Entities, update *UpdateBotChatInviteRequester) error |
|
|
|
// OnBotChatInviteRequester sets BotChatInviteRequester handler. |
|
func (u UpdateDispatcher) OnBotChatInviteRequester(handler BotChatInviteRequesterHandler) { |
|
u.handlers[UpdateBotChatInviteRequesterTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateBotChatInviteRequester)) |
|
} |
|
} |
|
|
|
// MessageReactionsHandler is a MessageReactions event handler. |
|
type MessageReactionsHandler func(ctx context.Context, e Entities, update *UpdateMessageReactions) error |
|
|
|
// OnMessageReactions sets MessageReactions handler. |
|
func (u UpdateDispatcher) OnMessageReactions(handler MessageReactionsHandler) { |
|
u.handlers[UpdateMessageReactionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { |
|
return handler(ctx, e, update.(*UpdateMessageReactions)) |
|
} |
|
}
|
|
|