7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
1558 lines
69 KiB
Go
1558 lines
69 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/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))
|
|
}
|
|
}
|
|
|
|
// NewAuthorizationHandler is a NewAuthorization event handler.
|
|
type NewAuthorizationHandler func(ctx context.Context, e Entities, update *UpdateNewAuthorization) error
|
|
|
|
// OnNewAuthorization sets NewAuthorization handler.
|
|
func (u UpdateDispatcher) OnNewAuthorization(handler NewAuthorizationHandler) {
|
|
u.handlers[UpdateNewAuthorizationTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateNewAuthorization))
|
|
}
|
|
}
|
|
|
|
// 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))
|
|
}
|
|
}
|
|
|
|
// AttachMenuBotsHandler is a AttachMenuBots event handler.
|
|
type AttachMenuBotsHandler func(ctx context.Context, e Entities, update *UpdateAttachMenuBots) error
|
|
|
|
// OnAttachMenuBots sets AttachMenuBots handler.
|
|
func (u UpdateDispatcher) OnAttachMenuBots(handler AttachMenuBotsHandler) {
|
|
u.handlers[UpdateAttachMenuBotsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateAttachMenuBots))
|
|
}
|
|
}
|
|
|
|
// WebViewResultSentHandler is a WebViewResultSent event handler.
|
|
type WebViewResultSentHandler func(ctx context.Context, e Entities, update *UpdateWebViewResultSent) error
|
|
|
|
// OnWebViewResultSent sets WebViewResultSent handler.
|
|
func (u UpdateDispatcher) OnWebViewResultSent(handler WebViewResultSentHandler) {
|
|
u.handlers[UpdateWebViewResultSentTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateWebViewResultSent))
|
|
}
|
|
}
|
|
|
|
// BotMenuButtonHandler is a BotMenuButton event handler.
|
|
type BotMenuButtonHandler func(ctx context.Context, e Entities, update *UpdateBotMenuButton) error
|
|
|
|
// OnBotMenuButton sets BotMenuButton handler.
|
|
func (u UpdateDispatcher) OnBotMenuButton(handler BotMenuButtonHandler) {
|
|
u.handlers[UpdateBotMenuButtonTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotMenuButton))
|
|
}
|
|
}
|
|
|
|
// SavedRingtonesHandler is a SavedRingtones event handler.
|
|
type SavedRingtonesHandler func(ctx context.Context, e Entities, update *UpdateSavedRingtones) error
|
|
|
|
// OnSavedRingtones sets SavedRingtones handler.
|
|
func (u UpdateDispatcher) OnSavedRingtones(handler SavedRingtonesHandler) {
|
|
u.handlers[UpdateSavedRingtonesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSavedRingtones))
|
|
}
|
|
}
|
|
|
|
// TranscribedAudioHandler is a TranscribedAudio event handler.
|
|
type TranscribedAudioHandler func(ctx context.Context, e Entities, update *UpdateTranscribedAudio) error
|
|
|
|
// OnTranscribedAudio sets TranscribedAudio handler.
|
|
func (u UpdateDispatcher) OnTranscribedAudio(handler TranscribedAudioHandler) {
|
|
u.handlers[UpdateTranscribedAudioTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateTranscribedAudio))
|
|
}
|
|
}
|
|
|
|
// ReadFeaturedEmojiStickersHandler is a ReadFeaturedEmojiStickers event handler.
|
|
type ReadFeaturedEmojiStickersHandler func(ctx context.Context, e Entities, update *UpdateReadFeaturedEmojiStickers) error
|
|
|
|
// OnReadFeaturedEmojiStickers sets ReadFeaturedEmojiStickers handler.
|
|
func (u UpdateDispatcher) OnReadFeaturedEmojiStickers(handler ReadFeaturedEmojiStickersHandler) {
|
|
u.handlers[UpdateReadFeaturedEmojiStickersTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateReadFeaturedEmojiStickers))
|
|
}
|
|
}
|
|
|
|
// UserEmojiStatusHandler is a UserEmojiStatus event handler.
|
|
type UserEmojiStatusHandler func(ctx context.Context, e Entities, update *UpdateUserEmojiStatus) error
|
|
|
|
// OnUserEmojiStatus sets UserEmojiStatus handler.
|
|
func (u UpdateDispatcher) OnUserEmojiStatus(handler UserEmojiStatusHandler) {
|
|
u.handlers[UpdateUserEmojiStatusTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateUserEmojiStatus))
|
|
}
|
|
}
|
|
|
|
// RecentEmojiStatusesHandler is a RecentEmojiStatuses event handler.
|
|
type RecentEmojiStatusesHandler func(ctx context.Context, e Entities, update *UpdateRecentEmojiStatuses) error
|
|
|
|
// OnRecentEmojiStatuses sets RecentEmojiStatuses handler.
|
|
func (u UpdateDispatcher) OnRecentEmojiStatuses(handler RecentEmojiStatusesHandler) {
|
|
u.handlers[UpdateRecentEmojiStatusesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateRecentEmojiStatuses))
|
|
}
|
|
}
|
|
|
|
// RecentReactionsHandler is a RecentReactions event handler.
|
|
type RecentReactionsHandler func(ctx context.Context, e Entities, update *UpdateRecentReactions) error
|
|
|
|
// OnRecentReactions sets RecentReactions handler.
|
|
func (u UpdateDispatcher) OnRecentReactions(handler RecentReactionsHandler) {
|
|
u.handlers[UpdateRecentReactionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateRecentReactions))
|
|
}
|
|
}
|
|
|
|
// MoveStickerSetToTopHandler is a MoveStickerSetToTop event handler.
|
|
type MoveStickerSetToTopHandler func(ctx context.Context, e Entities, update *UpdateMoveStickerSetToTop) error
|
|
|
|
// OnMoveStickerSetToTop sets MoveStickerSetToTop handler.
|
|
func (u UpdateDispatcher) OnMoveStickerSetToTop(handler MoveStickerSetToTopHandler) {
|
|
u.handlers[UpdateMoveStickerSetToTopTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateMoveStickerSetToTop))
|
|
}
|
|
}
|
|
|
|
// MessageExtendedMediaHandler is a MessageExtendedMedia event handler.
|
|
type MessageExtendedMediaHandler func(ctx context.Context, e Entities, update *UpdateMessageExtendedMedia) error
|
|
|
|
// OnMessageExtendedMedia sets MessageExtendedMedia handler.
|
|
func (u UpdateDispatcher) OnMessageExtendedMedia(handler MessageExtendedMediaHandler) {
|
|
u.handlers[UpdateMessageExtendedMediaTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateMessageExtendedMedia))
|
|
}
|
|
}
|
|
|
|
// ChannelPinnedTopicHandler is a ChannelPinnedTopic event handler.
|
|
type ChannelPinnedTopicHandler func(ctx context.Context, e Entities, update *UpdateChannelPinnedTopic) error
|
|
|
|
// OnChannelPinnedTopic sets ChannelPinnedTopic handler.
|
|
func (u UpdateDispatcher) OnChannelPinnedTopic(handler ChannelPinnedTopicHandler) {
|
|
u.handlers[UpdateChannelPinnedTopicTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateChannelPinnedTopic))
|
|
}
|
|
}
|
|
|
|
// ChannelPinnedTopicsHandler is a ChannelPinnedTopics event handler.
|
|
type ChannelPinnedTopicsHandler func(ctx context.Context, e Entities, update *UpdateChannelPinnedTopics) error
|
|
|
|
// OnChannelPinnedTopics sets ChannelPinnedTopics handler.
|
|
func (u UpdateDispatcher) OnChannelPinnedTopics(handler ChannelPinnedTopicsHandler) {
|
|
u.handlers[UpdateChannelPinnedTopicsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateChannelPinnedTopics))
|
|
}
|
|
}
|
|
|
|
// UserHandler is a User event handler.
|
|
type UserHandler func(ctx context.Context, e Entities, update *UpdateUser) error
|
|
|
|
// OnUser sets User handler.
|
|
func (u UpdateDispatcher) OnUser(handler UserHandler) {
|
|
u.handlers[UpdateUserTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateUser))
|
|
}
|
|
}
|
|
|
|
// AutoSaveSettingsHandler is a AutoSaveSettings event handler.
|
|
type AutoSaveSettingsHandler func(ctx context.Context, e Entities, update *UpdateAutoSaveSettings) error
|
|
|
|
// OnAutoSaveSettings sets AutoSaveSettings handler.
|
|
func (u UpdateDispatcher) OnAutoSaveSettings(handler AutoSaveSettingsHandler) {
|
|
u.handlers[UpdateAutoSaveSettingsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateAutoSaveSettings))
|
|
}
|
|
}
|
|
|
|
// StoryHandler is a Story event handler.
|
|
type StoryHandler func(ctx context.Context, e Entities, update *UpdateStory) error
|
|
|
|
// OnStory sets Story handler.
|
|
func (u UpdateDispatcher) OnStory(handler StoryHandler) {
|
|
u.handlers[UpdateStoryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateStory))
|
|
}
|
|
}
|
|
|
|
// ReadStoriesHandler is a ReadStories event handler.
|
|
type ReadStoriesHandler func(ctx context.Context, e Entities, update *UpdateReadStories) error
|
|
|
|
// OnReadStories sets ReadStories handler.
|
|
func (u UpdateDispatcher) OnReadStories(handler ReadStoriesHandler) {
|
|
u.handlers[UpdateReadStoriesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateReadStories))
|
|
}
|
|
}
|
|
|
|
// StoryIDHandler is a StoryID event handler.
|
|
type StoryIDHandler func(ctx context.Context, e Entities, update *UpdateStoryID) error
|
|
|
|
// OnStoryID sets StoryID handler.
|
|
func (u UpdateDispatcher) OnStoryID(handler StoryIDHandler) {
|
|
u.handlers[UpdateStoryIDTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateStoryID))
|
|
}
|
|
}
|
|
|
|
// StoriesStealthModeHandler is a StoriesStealthMode event handler.
|
|
type StoriesStealthModeHandler func(ctx context.Context, e Entities, update *UpdateStoriesStealthMode) error
|
|
|
|
// OnStoriesStealthMode sets StoriesStealthMode handler.
|
|
func (u UpdateDispatcher) OnStoriesStealthMode(handler StoriesStealthModeHandler) {
|
|
u.handlers[UpdateStoriesStealthModeTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateStoriesStealthMode))
|
|
}
|
|
}
|
|
|
|
// SentStoryReactionHandler is a SentStoryReaction event handler.
|
|
type SentStoryReactionHandler func(ctx context.Context, e Entities, update *UpdateSentStoryReaction) error
|
|
|
|
// OnSentStoryReaction sets SentStoryReaction handler.
|
|
func (u UpdateDispatcher) OnSentStoryReaction(handler SentStoryReactionHandler) {
|
|
u.handlers[UpdateSentStoryReactionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSentStoryReaction))
|
|
}
|
|
}
|
|
|
|
// BotChatBoostHandler is a BotChatBoost event handler.
|
|
type BotChatBoostHandler func(ctx context.Context, e Entities, update *UpdateBotChatBoost) error
|
|
|
|
// OnBotChatBoost sets BotChatBoost handler.
|
|
func (u UpdateDispatcher) OnBotChatBoost(handler BotChatBoostHandler) {
|
|
u.handlers[UpdateBotChatBoostTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotChatBoost))
|
|
}
|
|
}
|
|
|
|
// ChannelViewForumAsMessagesHandler is a ChannelViewForumAsMessages event handler.
|
|
type ChannelViewForumAsMessagesHandler func(ctx context.Context, e Entities, update *UpdateChannelViewForumAsMessages) error
|
|
|
|
// OnChannelViewForumAsMessages sets ChannelViewForumAsMessages handler.
|
|
func (u UpdateDispatcher) OnChannelViewForumAsMessages(handler ChannelViewForumAsMessagesHandler) {
|
|
u.handlers[UpdateChannelViewForumAsMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateChannelViewForumAsMessages))
|
|
}
|
|
}
|
|
|
|
// PeerWallpaperHandler is a PeerWallpaper event handler.
|
|
type PeerWallpaperHandler func(ctx context.Context, e Entities, update *UpdatePeerWallpaper) error
|
|
|
|
// OnPeerWallpaper sets PeerWallpaper handler.
|
|
func (u UpdateDispatcher) OnPeerWallpaper(handler PeerWallpaperHandler) {
|
|
u.handlers[UpdatePeerWallpaperTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdatePeerWallpaper))
|
|
}
|
|
}
|
|
|
|
// BotMessageReactionHandler is a BotMessageReaction event handler.
|
|
type BotMessageReactionHandler func(ctx context.Context, e Entities, update *UpdateBotMessageReaction) error
|
|
|
|
// OnBotMessageReaction sets BotMessageReaction handler.
|
|
func (u UpdateDispatcher) OnBotMessageReaction(handler BotMessageReactionHandler) {
|
|
u.handlers[UpdateBotMessageReactionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotMessageReaction))
|
|
}
|
|
}
|
|
|
|
// BotMessageReactionsHandler is a BotMessageReactions event handler.
|
|
type BotMessageReactionsHandler func(ctx context.Context, e Entities, update *UpdateBotMessageReactions) error
|
|
|
|
// OnBotMessageReactions sets BotMessageReactions handler.
|
|
func (u UpdateDispatcher) OnBotMessageReactions(handler BotMessageReactionsHandler) {
|
|
u.handlers[UpdateBotMessageReactionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotMessageReactions))
|
|
}
|
|
}
|
|
|
|
// SavedDialogPinnedHandler is a SavedDialogPinned event handler.
|
|
type SavedDialogPinnedHandler func(ctx context.Context, e Entities, update *UpdateSavedDialogPinned) error
|
|
|
|
// OnSavedDialogPinned sets SavedDialogPinned handler.
|
|
func (u UpdateDispatcher) OnSavedDialogPinned(handler SavedDialogPinnedHandler) {
|
|
u.handlers[UpdateSavedDialogPinnedTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSavedDialogPinned))
|
|
}
|
|
}
|
|
|
|
// PinnedSavedDialogsHandler is a PinnedSavedDialogs event handler.
|
|
type PinnedSavedDialogsHandler func(ctx context.Context, e Entities, update *UpdatePinnedSavedDialogs) error
|
|
|
|
// OnPinnedSavedDialogs sets PinnedSavedDialogs handler.
|
|
func (u UpdateDispatcher) OnPinnedSavedDialogs(handler PinnedSavedDialogsHandler) {
|
|
u.handlers[UpdatePinnedSavedDialogsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdatePinnedSavedDialogs))
|
|
}
|
|
}
|
|
|
|
// SavedReactionTagsHandler is a SavedReactionTags event handler.
|
|
type SavedReactionTagsHandler func(ctx context.Context, e Entities, update *UpdateSavedReactionTags) error
|
|
|
|
// OnSavedReactionTags sets SavedReactionTags handler.
|
|
func (u UpdateDispatcher) OnSavedReactionTags(handler SavedReactionTagsHandler) {
|
|
u.handlers[UpdateSavedReactionTagsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSavedReactionTags))
|
|
}
|
|
}
|
|
|
|
// SMSJobHandler is a SMSJob event handler.
|
|
type SMSJobHandler func(ctx context.Context, e Entities, update *UpdateSMSJob) error
|
|
|
|
// OnSMSJob sets SMSJob handler.
|
|
func (u UpdateDispatcher) OnSMSJob(handler SMSJobHandler) {
|
|
u.handlers[UpdateSMSJobTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSMSJob))
|
|
}
|
|
}
|
|
|
|
// QuickRepliesHandler is a QuickReplies event handler.
|
|
type QuickRepliesHandler func(ctx context.Context, e Entities, update *UpdateQuickReplies) error
|
|
|
|
// OnQuickReplies sets QuickReplies handler.
|
|
func (u UpdateDispatcher) OnQuickReplies(handler QuickRepliesHandler) {
|
|
u.handlers[UpdateQuickRepliesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateQuickReplies))
|
|
}
|
|
}
|
|
|
|
// NewQuickReplyHandler is a NewQuickReply event handler.
|
|
type NewQuickReplyHandler func(ctx context.Context, e Entities, update *UpdateNewQuickReply) error
|
|
|
|
// OnNewQuickReply sets NewQuickReply handler.
|
|
func (u UpdateDispatcher) OnNewQuickReply(handler NewQuickReplyHandler) {
|
|
u.handlers[UpdateNewQuickReplyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateNewQuickReply))
|
|
}
|
|
}
|
|
|
|
// DeleteQuickReplyHandler is a DeleteQuickReply event handler.
|
|
type DeleteQuickReplyHandler func(ctx context.Context, e Entities, update *UpdateDeleteQuickReply) error
|
|
|
|
// OnDeleteQuickReply sets DeleteQuickReply handler.
|
|
func (u UpdateDispatcher) OnDeleteQuickReply(handler DeleteQuickReplyHandler) {
|
|
u.handlers[UpdateDeleteQuickReplyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateDeleteQuickReply))
|
|
}
|
|
}
|
|
|
|
// QuickReplyMessageHandler is a QuickReplyMessage event handler.
|
|
type QuickReplyMessageHandler func(ctx context.Context, e Entities, update *UpdateQuickReplyMessage) error
|
|
|
|
// OnQuickReplyMessage sets QuickReplyMessage handler.
|
|
func (u UpdateDispatcher) OnQuickReplyMessage(handler QuickReplyMessageHandler) {
|
|
u.handlers[UpdateQuickReplyMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateQuickReplyMessage))
|
|
}
|
|
}
|
|
|
|
// DeleteQuickReplyMessagesHandler is a DeleteQuickReplyMessages event handler.
|
|
type DeleteQuickReplyMessagesHandler func(ctx context.Context, e Entities, update *UpdateDeleteQuickReplyMessages) error
|
|
|
|
// OnDeleteQuickReplyMessages sets DeleteQuickReplyMessages handler.
|
|
func (u UpdateDispatcher) OnDeleteQuickReplyMessages(handler DeleteQuickReplyMessagesHandler) {
|
|
u.handlers[UpdateDeleteQuickReplyMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateDeleteQuickReplyMessages))
|
|
}
|
|
}
|
|
|
|
// BotBusinessConnectHandler is a BotBusinessConnect event handler.
|
|
type BotBusinessConnectHandler func(ctx context.Context, e Entities, update *UpdateBotBusinessConnect) error
|
|
|
|
// OnBotBusinessConnect sets BotBusinessConnect handler.
|
|
func (u UpdateDispatcher) OnBotBusinessConnect(handler BotBusinessConnectHandler) {
|
|
u.handlers[UpdateBotBusinessConnectTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotBusinessConnect))
|
|
}
|
|
}
|
|
|
|
// BotNewBusinessMessageHandler is a BotNewBusinessMessage event handler.
|
|
type BotNewBusinessMessageHandler func(ctx context.Context, e Entities, update *UpdateBotNewBusinessMessage) error
|
|
|
|
// OnBotNewBusinessMessage sets BotNewBusinessMessage handler.
|
|
func (u UpdateDispatcher) OnBotNewBusinessMessage(handler BotNewBusinessMessageHandler) {
|
|
u.handlers[UpdateBotNewBusinessMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotNewBusinessMessage))
|
|
}
|
|
}
|
|
|
|
// BotEditBusinessMessageHandler is a BotEditBusinessMessage event handler.
|
|
type BotEditBusinessMessageHandler func(ctx context.Context, e Entities, update *UpdateBotEditBusinessMessage) error
|
|
|
|
// OnBotEditBusinessMessage sets BotEditBusinessMessage handler.
|
|
func (u UpdateDispatcher) OnBotEditBusinessMessage(handler BotEditBusinessMessageHandler) {
|
|
u.handlers[UpdateBotEditBusinessMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotEditBusinessMessage))
|
|
}
|
|
}
|
|
|
|
// BotDeleteBusinessMessageHandler is a BotDeleteBusinessMessage event handler.
|
|
type BotDeleteBusinessMessageHandler func(ctx context.Context, e Entities, update *UpdateBotDeleteBusinessMessage) error
|
|
|
|
// OnBotDeleteBusinessMessage sets BotDeleteBusinessMessage handler.
|
|
func (u UpdateDispatcher) OnBotDeleteBusinessMessage(handler BotDeleteBusinessMessageHandler) {
|
|
u.handlers[UpdateBotDeleteBusinessMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotDeleteBusinessMessage))
|
|
}
|
|
}
|
|
|
|
// NewStoryReactionHandler is a NewStoryReaction event handler.
|
|
type NewStoryReactionHandler func(ctx context.Context, e Entities, update *UpdateNewStoryReaction) error
|
|
|
|
// OnNewStoryReaction sets NewStoryReaction handler.
|
|
func (u UpdateDispatcher) OnNewStoryReaction(handler NewStoryReactionHandler) {
|
|
u.handlers[UpdateNewStoryReactionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateNewStoryReaction))
|
|
}
|
|
}
|
|
|
|
// BroadcastRevenueTransactionsHandler is a BroadcastRevenueTransactions event handler.
|
|
type BroadcastRevenueTransactionsHandler func(ctx context.Context, e Entities, update *UpdateBroadcastRevenueTransactions) error
|
|
|
|
// OnBroadcastRevenueTransactions sets BroadcastRevenueTransactions handler.
|
|
func (u UpdateDispatcher) OnBroadcastRevenueTransactions(handler BroadcastRevenueTransactionsHandler) {
|
|
u.handlers[UpdateBroadcastRevenueTransactionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBroadcastRevenueTransactions))
|
|
}
|
|
}
|
|
|
|
// StarsBalanceHandler is a StarsBalance event handler.
|
|
type StarsBalanceHandler func(ctx context.Context, e Entities, update *UpdateStarsBalance) error
|
|
|
|
// OnStarsBalance sets StarsBalance handler.
|
|
func (u UpdateDispatcher) OnStarsBalance(handler StarsBalanceHandler) {
|
|
u.handlers[UpdateStarsBalanceTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateStarsBalance))
|
|
}
|
|
}
|
|
|
|
// BusinessBotCallbackQueryHandler is a BusinessBotCallbackQuery event handler.
|
|
type BusinessBotCallbackQueryHandler func(ctx context.Context, e Entities, update *UpdateBusinessBotCallbackQuery) error
|
|
|
|
// OnBusinessBotCallbackQuery sets BusinessBotCallbackQuery handler.
|
|
func (u UpdateDispatcher) OnBusinessBotCallbackQuery(handler BusinessBotCallbackQueryHandler) {
|
|
u.handlers[UpdateBusinessBotCallbackQueryTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBusinessBotCallbackQuery))
|
|
}
|
|
}
|
|
|
|
// StarsRevenueStatusHandler is a StarsRevenueStatus event handler.
|
|
type StarsRevenueStatusHandler func(ctx context.Context, e Entities, update *UpdateStarsRevenueStatus) error
|
|
|
|
// OnStarsRevenueStatus sets StarsRevenueStatus handler.
|
|
func (u UpdateDispatcher) OnStarsRevenueStatus(handler StarsRevenueStatusHandler) {
|
|
u.handlers[UpdateStarsRevenueStatusTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateStarsRevenueStatus))
|
|
}
|
|
}
|
|
|
|
// BotPurchasedPaidMediaHandler is a BotPurchasedPaidMedia event handler.
|
|
type BotPurchasedPaidMediaHandler func(ctx context.Context, e Entities, update *UpdateBotPurchasedPaidMedia) error
|
|
|
|
// OnBotPurchasedPaidMedia sets BotPurchasedPaidMedia handler.
|
|
func (u UpdateDispatcher) OnBotPurchasedPaidMedia(handler BotPurchasedPaidMediaHandler) {
|
|
u.handlers[UpdateBotPurchasedPaidMediaTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateBotPurchasedPaidMedia))
|
|
}
|
|
}
|
|
|
|
// PaidReactionPrivacyHandler is a PaidReactionPrivacy event handler.
|
|
type PaidReactionPrivacyHandler func(ctx context.Context, e Entities, update *UpdatePaidReactionPrivacy) error
|
|
|
|
// OnPaidReactionPrivacy sets PaidReactionPrivacy handler.
|
|
func (u UpdateDispatcher) OnPaidReactionPrivacy(handler PaidReactionPrivacyHandler) {
|
|
u.handlers[UpdatePaidReactionPrivacyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdatePaidReactionPrivacy))
|
|
}
|
|
}
|
|
|
|
// SentPhoneCodeHandler is a SentPhoneCode event handler.
|
|
type SentPhoneCodeHandler func(ctx context.Context, e Entities, update *UpdateSentPhoneCode) error
|
|
|
|
// OnSentPhoneCode sets SentPhoneCode handler.
|
|
func (u UpdateDispatcher) OnSentPhoneCode(handler SentPhoneCodeHandler) {
|
|
u.handlers[UpdateSentPhoneCodeTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateSentPhoneCode))
|
|
}
|
|
}
|
|
|
|
// GroupCallChainBlocksHandler is a GroupCallChainBlocks event handler.
|
|
type GroupCallChainBlocksHandler func(ctx context.Context, e Entities, update *UpdateGroupCallChainBlocks) error
|
|
|
|
// OnGroupCallChainBlocks sets GroupCallChainBlocks handler.
|
|
func (u UpdateDispatcher) OnGroupCallChainBlocks(handler GroupCallChainBlocksHandler) {
|
|
u.handlers[UpdateGroupCallChainBlocksTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateGroupCallChainBlocks))
|
|
}
|
|
}
|
|
|
|
// ReadMonoForumInboxHandler is a ReadMonoForumInbox event handler.
|
|
type ReadMonoForumInboxHandler func(ctx context.Context, e Entities, update *UpdateReadMonoForumInbox) error
|
|
|
|
// OnReadMonoForumInbox sets ReadMonoForumInbox handler.
|
|
func (u UpdateDispatcher) OnReadMonoForumInbox(handler ReadMonoForumInboxHandler) {
|
|
u.handlers[UpdateReadMonoForumInboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateReadMonoForumInbox))
|
|
}
|
|
}
|
|
|
|
// ReadMonoForumOutboxHandler is a ReadMonoForumOutbox event handler.
|
|
type ReadMonoForumOutboxHandler func(ctx context.Context, e Entities, update *UpdateReadMonoForumOutbox) error
|
|
|
|
// OnReadMonoForumOutbox sets ReadMonoForumOutbox handler.
|
|
func (u UpdateDispatcher) OnReadMonoForumOutbox(handler ReadMonoForumOutboxHandler) {
|
|
u.handlers[UpdateReadMonoForumOutboxTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
|
return handler(ctx, e, update.(*UpdateReadMonoForumOutbox))
|
|
}
|
|
}
|