-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
tl_handlers_gen.go
1035 lines (836 loc) · 44.3 KB
/
tl_handlers_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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/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{}
)
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[int]*User
Chats map[int]*Chat
Channels map[int]*Channel
}
func (u *Entities) short() {
u.Short = true
u.Users = make(map[int]*User, 0)
u.Chats = make(map[int]*Chat, 0)
u.Channels = make(map[int]*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.