-
Notifications
You must be signed in to change notification settings - Fork 7
/
td.py
1586 lines (1417 loc) · 76.4 KB
/
td.py
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
file_path = "BetterTG/Extensions/Td+Generated.swift"
core = """// Td+Generated.swift
// This file is generated from td.py
// Any modifications will be overwritten
import SwiftUI
import TDLibKit
// swiftlint:disable line_length
"""
update_func = """// swiftlint:disable:next function_body_length
func update(_ update: Update) {
switch update {
case .updateAuthorizationState(let updateAuthorizationState):
UpdateAuthorizationState(updateAuthorizationState.authorizationState)
"""
def main(update: str):
(notifications, notification_names, update_cases) = ([], [], [])
for line in update.split("\n"):
if "case " in line and "(" in line and "(let" not in line:
after_case = line.split("case ")[1]
name_split = after_case.split("(")
name = name_split[0]
type = name_split[1].split(")")[0]
notifications.append(
f" static var {name}: TdNotification<{
type}> {{ .init(.{name}) }}\n"
)
notification_names.append(
f" static let {name} = Self(\"{name}\")\n")
if name == "updateAuthorizationState":
continue
update_cases.append(
(
f" case .{name}(let {name}):\n",
f" nc.post(name: .{name}, object: {name})\n"
)
)
file = open(file_path, "w")
file.write(core)
for line in update_func:
file.write(line)
for update_case in update_cases:
file.write(update_case[0])
file.write(update_case[1])
file.write(" }\n")
file.write("}\n\n")
file.write("extension TdNotification {\n")
for notification in notifications:
file.write(notification)
file.write("}\n\n")
file.write("extension Foundation.Notification.Name {\n")
for notification_name in notification_names:
file.write(notification_name)
file.write("}\n\n")
file.write("// swiftlint:enable line_length\n\n")
file.write("// swiftlint:disable:this file_length\n")
file.close()
# probably, fetching from currently used tdlib is better, but this solution is faster to implement
update = """
public indirect enum Update: Codable, Equatable, Hashable {
/// The user authorization state has changed
case updateAuthorizationState(UpdateAuthorizationState)
/// A new message was received; can also be an outgoing message
case updateNewMessage(UpdateNewMessage)
/// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. This update is sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message
case updateMessageSendAcknowledged(UpdateMessageSendAcknowledged)
/// A message has been successfully sent
case updateMessageSendSucceeded(UpdateMessageSendSucceeded)
/// A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update
case updateMessageSendFailed(UpdateMessageSendFailed)
/// The message content has changed
case updateMessageContent(UpdateMessageContent)
/// A message was edited. Changes in the message content will come in a separate updateMessageContent
case updateMessageEdited(UpdateMessageEdited)
/// The message pinned state was changed
case updateMessageIsPinned(UpdateMessageIsPinned)
/// The information about interactions with a message has changed
case updateMessageInteractionInfo(UpdateMessageInteractionInfo)
/// The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the self-destruct timer
case updateMessageContentOpened(UpdateMessageContentOpened)
/// A message with an unread mention was read
case updateMessageMentionRead(UpdateMessageMentionRead)
/// The list of unread reactions added to a message was changed
case updateMessageUnreadReactions(UpdateMessageUnreadReactions)
/// A fact-check added to a message was changed
case updateMessageFactCheck(UpdateMessageFactCheck)
/// A message with a live location was viewed. When the update is received, the application is supposed to update the live location
case updateMessageLiveLocationViewed(UpdateMessageLiveLocationViewed)
/// A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates
case updateNewChat(UpdateNewChat)
/// The title of a chat was changed
case updateChatTitle(UpdateChatTitle)
/// A chat photo was changed
case updateChatPhoto(UpdateChatPhoto)
/// Chat accent colors have changed
case updateChatAccentColors(UpdateChatAccentColors)
/// Chat permissions were changed
case updateChatPermissions(UpdateChatPermissions)
/// The last message of a chat was changed
case updateChatLastMessage(UpdateChatLastMessage)
/// The position of a chat in a chat list has changed. An updateChatLastMessage or updateChatDraftMessage update might be sent instead of the update
case updateChatPosition(UpdateChatPosition)
/// A chat was added to a chat list
case updateChatAddedToList(UpdateChatAddedToList)
/// A chat was removed from a chat list
case updateChatRemovedFromList(UpdateChatRemovedFromList)
/// Incoming messages were read or the number of unread messages has been changed
case updateChatReadInbox(UpdateChatReadInbox)
/// Outgoing messages were read
case updateChatReadOutbox(UpdateChatReadOutbox)
/// The chat action bar was changed
case updateChatActionBar(UpdateChatActionBar)
/// The bar for managing business bot was changed in a chat
case updateChatBusinessBotManageBar(UpdateChatBusinessBotManageBar)
/// The chat available reactions were changed
case updateChatAvailableReactions(UpdateChatAvailableReactions)
/// A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update mustn't be applied
case updateChatDraftMessage(UpdateChatDraftMessage)
/// Chat emoji status has changed
case updateChatEmojiStatus(UpdateChatEmojiStatus)
/// The message sender that is selected to send messages in a chat has changed
case updateChatMessageSender(UpdateChatMessageSender)
/// The message auto-delete or self-destruct timer setting for a chat was changed
case updateChatMessageAutoDeleteTime(UpdateChatMessageAutoDeleteTime)
/// Notification settings for a chat were changed
case updateChatNotificationSettings(UpdateChatNotificationSettings)
/// The chat pending join requests were changed
case updateChatPendingJoinRequests(UpdateChatPendingJoinRequests)
/// The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user
case updateChatReplyMarkup(UpdateChatReplyMarkup)
/// The chat background was changed
case updateChatBackground(UpdateChatBackground)
/// The chat theme was changed
case updateChatTheme(UpdateChatTheme)
/// The chat unread_mention_count has changed
case updateChatUnreadMentionCount(UpdateChatUnreadMentionCount)
/// The chat unread_reaction_count has changed
case updateChatUnreadReactionCount(UpdateChatUnreadReactionCount)
/// A chat video chat state has changed
case updateChatVideoChat(UpdateChatVideoChat)
/// The value of the default disable_notification parameter, used when a message is sent to the chat, was changed
case updateChatDefaultDisableNotification(UpdateChatDefaultDisableNotification)
/// A chat content was allowed or restricted for saving
case updateChatHasProtectedContent(UpdateChatHasProtectedContent)
/// Translation of chat messages was enabled or disabled
case updateChatIsTranslatable(UpdateChatIsTranslatable)
/// A chat was marked as unread or was read
case updateChatIsMarkedAsUnread(UpdateChatIsMarkedAsUnread)
/// A chat default appearance has changed
case updateChatViewAsTopics(UpdateChatViewAsTopics)
/// A chat was blocked or unblocked
case updateChatBlockList(UpdateChatBlockList)
/// A chat's has_scheduled_messages field has changed
case updateChatHasScheduledMessages(UpdateChatHasScheduledMessages)
/// The list of chat folders or a chat folder has changed
case updateChatFolders(UpdateChatFolders)
/// The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it is sent just after the number of online users has changed
case updateChatOnlineMemberCount(UpdateChatOnlineMemberCount)
/// Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application
case updateSavedMessagesTopic(UpdateSavedMessagesTopic)
/// Number of Saved Messages topics has changed
case updateSavedMessagesTopicCount(UpdateSavedMessagesTopicCount)
/// Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application
case updateQuickReplyShortcut(UpdateQuickReplyShortcut)
/// A quick reply shortcut and all its messages were deleted
case updateQuickReplyShortcutDeleted(UpdateQuickReplyShortcutDeleted)
/// The list of quick reply shortcuts has changed
case updateQuickReplyShortcuts(UpdateQuickReplyShortcuts)
/// The list of quick reply shortcut messages has changed
case updateQuickReplyShortcutMessages(UpdateQuickReplyShortcutMessages)
/// Basic information about a topic in a forum chat was changed
case updateForumTopicInfo(UpdateForumTopicInfo)
/// Notification settings for some type of chats were updated
case updateScopeNotificationSettings(UpdateScopeNotificationSettings)
/// Notification settings for reactions were updated
case updateReactionNotificationSettings(UpdateReactionNotificationSettings)
/// A notification was changed
case updateNotification(UpdateNotification)
/// A list of active notifications in a notification group has changed
case updateNotificationGroup(UpdateNotificationGroup)
/// Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update
case updateActiveNotifications(UpdateActiveNotifications)
/// Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications
case updateHavePendingNotifications(UpdateHavePendingNotifications)
/// Some messages were deleted
case updateDeleteMessages(UpdateDeleteMessages)
/// A message sender activity in the chat has changed
case updateChatAction(UpdateChatAction)
/// The user went online or offline
case updateUserStatus(UpdateUserStatus)
/// Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the application
case updateUser(UpdateUser)
/// Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the application
case updateBasicGroup(UpdateBasicGroup)
/// Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the application
case updateSupergroup(UpdateSupergroup)
/// Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the application
case updateSecretChat(UpdateSecretChat)
/// Some data in userFullInfo has been changed
case updateUserFullInfo(UpdateUserFullInfo)
/// Some data in basicGroupFullInfo has been changed
case updateBasicGroupFullInfo(UpdateBasicGroupFullInfo)
/// Some data in supergroupFullInfo has been changed
case updateSupergroupFullInfo(UpdateSupergroupFullInfo)
/// A service notification from the server was received. Upon receiving this the application must show a popup with the content of the notification
case updateServiceNotification(UpdateServiceNotification)
/// Information about a file was updated
case updateFile(UpdateFile)
/// The file generation process needs to be started by the application
case updateFileGenerationStart(UpdateFileGenerationStart)
/// File generation is no longer needed
case updateFileGenerationStop(UpdateFileGenerationStop)
/// The state of the file download list has changed
case updateFileDownloads(UpdateFileDownloads)
/// A file was added to the file download list. This update is sent only after file download list is loaded for the first time
case updateFileAddedToDownloads(UpdateFileAddedToDownloads)
/// A file download was changed. This update is sent only after file download list is loaded for the first time
case updateFileDownload(UpdateFileDownload)
/// A file was removed from the file download list. This update is sent only after file download list is loaded for the first time
case updateFileRemovedFromDownloads(UpdateFileRemovedFromDownloads)
/// A request can't be completed unless application verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed
case updateApplicationVerificationRequired(UpdateApplicationVerificationRequired)
/// New call was created or information about a call was updated
case updateCall(UpdateCall)
/// Information about a group call was updated
case updateGroupCall(UpdateGroupCall)
/// Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined
case updateGroupCallParticipant(UpdateGroupCallParticipant)
/// New call signaling data arrived
case updateNewCallSignalingData(UpdateNewCallSignalingData)
/// Some privacy setting rules have been changed
case updateUserPrivacySettingRules(UpdateUserPrivacySettingRules)
/// Number of unread messages in a chat list has changed. This update is sent only if the message database is used
case updateUnreadMessageCount(UpdateUnreadMessageCount)
/// Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used
case updateUnreadChatCount(UpdateUnreadChatCount)
/// A story was changed
case updateStory(UpdateStory)
/// A story became inaccessible
case updateStoryDeleted(UpdateStoryDeleted)
/// A story has been successfully sent
case updateStorySendSucceeded(UpdateStorySendSucceeded)
/// A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update
case updateStorySendFailed(UpdateStorySendFailed)
/// The list of active stories posted by a specific chat has changed
case updateChatActiveStories(UpdateChatActiveStories)
/// Number of chats in a story list has changed
case updateStoryListChatCount(UpdateStoryListChatCount)
/// Story stealth mode settings have changed
case updateStoryStealthMode(UpdateStoryStealthMode)
/// An option changed its value
case updateOption(UpdateOption)
/// A sticker set has changed
case updateStickerSet(UpdateStickerSet)
/// The list of installed sticker sets was updated
case updateInstalledStickerSets(UpdateInstalledStickerSets)
/// The list of trending sticker sets was updated or some of them were viewed
case updateTrendingStickerSets(UpdateTrendingStickerSets)
/// The list of recently used stickers was updated
case updateRecentStickers(UpdateRecentStickers)
/// The list of favorite stickers was updated
case updateFavoriteStickers(UpdateFavoriteStickers)
/// The list of saved animations was updated
case updateSavedAnimations(UpdateSavedAnimations)
/// The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time
case updateSavedNotificationSounds(UpdateSavedNotificationSounds)
/// The default background has changed
case updateDefaultBackground(UpdateDefaultBackground)
/// The list of available chat themes has changed
case updateChatThemes(UpdateChatThemes)
/// The list of supported accent colors has changed
case updateAccentColors(UpdateAccentColors)
/// The list of supported accent colors for user profiles has changed
case updateProfileAccentColors(UpdateProfileAccentColors)
/// Some language pack strings have been updated
case updateLanguagePackStrings(UpdateLanguagePackStrings)
/// The connection state has changed. This update must be used only to show a human-readable description of the connection state
case updateConnectionState(UpdateConnectionState)
/// New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update"
case updateTermsOfService(UpdateTermsOfService)
/// The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request
case updateUsersNearby(UpdateUsersNearby)
/// The first unconfirmed session has changed
case updateUnconfirmedSession(UpdateUnconfirmedSession)
/// The list of bots added to attachment or side menu has changed
case updateAttachmentMenuBots(UpdateAttachmentMenuBots)
/// A message was sent by an opened Web App, so the Web App needs to be closed
case updateWebAppMessageSent(UpdateWebAppMessageSent)
/// The list of active emoji reactions has changed
case updateActiveEmojiReactions(UpdateActiveEmojiReactions)
/// The list of available message effects has changed
case updateAvailableMessageEffects(UpdateAvailableMessageEffects)
/// The type of default reaction has changed
case updateDefaultReactionType(UpdateDefaultReactionType)
/// Tags used in Saved Messages or a Saved Messages topic have changed
case updateSavedMessagesTags(UpdateSavedMessagesTags)
/// The number of Telegram stars owned by the current user has changed
case updateOwnedStarCount(UpdateOwnedStarCount)
/// The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions
case updateChatRevenueAmount(UpdateChatRevenueAmount)
/// The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions
case updateStarRevenueStatus(UpdateStarRevenueStatus)
/// The parameters of speech recognition without Telegram Premium subscription has changed
case updateSpeechRecognitionTrial(UpdateSpeechRecognitionTrial)
/// The list of supported dice emojis has changed
case updateDiceEmojis(UpdateDiceEmojis)
/// Some animated emoji message was clicked and a big animated sticker must be played if the message is visible on the screen. chatActionWatchingAnimations with the text of the message needs to be sent if the sticker is played
case updateAnimatedEmojiMessageClicked(UpdateAnimatedEmojiMessageClicked)
/// The parameters of animation search through getOption("animation_search_bot_username") bot has changed
case updateAnimationSearchParameters(UpdateAnimationSearchParameters)
/// The list of suggested to the user actions has changed
case updateSuggestedActions(UpdateSuggestedActions)
/// Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium
case updateSpeedLimitNotification(UpdateSpeedLimitNotification)
/// The list of contacts that had birthdays recently or will have birthday soon has changed
case updateContactCloseBirthdays(UpdateContactCloseBirthdays)
/// Autosave settings for some type of chats were updated
case updateAutosaveSettings(UpdateAutosaveSettings)
/// A business connection has changed; for bots only
case updateBusinessConnection(UpdateBusinessConnection)
/// A new message was added to a business account; for bots only
case updateNewBusinessMessage(UpdateNewBusinessMessage)
/// A message in a business account was edited; for bots only
case updateBusinessMessageEdited(UpdateBusinessMessageEdited)
/// Messages in a business account were deleted; for bots only
case updateBusinessMessagesDeleted(UpdateBusinessMessagesDeleted)
/// A new incoming inline query; for bots only
case updateNewInlineQuery(UpdateNewInlineQuery)
/// The user has chosen a result of an inline query; for bots only
case updateNewChosenInlineResult(UpdateNewChosenInlineResult)
/// A new incoming callback query; for bots only
case updateNewCallbackQuery(UpdateNewCallbackQuery)
/// A new incoming callback query from a message sent via a bot; for bots only
case updateNewInlineCallbackQuery(UpdateNewInlineCallbackQuery)
/// A new incoming callback query from a business message; for bots only
case updateNewBusinessCallbackQuery(UpdateNewBusinessCallbackQuery)
/// A new incoming shipping query; for bots only. Only for invoices with flexible price
case updateNewShippingQuery(UpdateNewShippingQuery)
/// A new incoming pre-checkout query; for bots only. Contains full information about a checkout
case updateNewPreCheckoutQuery(UpdateNewPreCheckoutQuery)
/// A new incoming event; for bots only
case updateNewCustomEvent(UpdateNewCustomEvent)
/// A new incoming query; for bots only
case updateNewCustomQuery(UpdateNewCustomQuery)
/// A poll was updated; for bots only
case updatePoll(UpdatePoll)
/// A user changed the answer to a poll; for bots only
case updatePollAnswer(UpdatePollAnswer)
/// User rights changed in a chat; for bots only
case updateChatMember(UpdateChatMember)
/// A user sent a join request to a chat; for bots only
case updateNewChatJoinRequest(UpdateNewChatJoinRequest)
/// A chat boost has changed; for bots only
case updateChatBoost(UpdateChatBoost)
/// User changed its reactions on a message with public reactions; for bots only
case updateMessageReaction(UpdateMessageReaction)
/// Reactions added to a message with anonymous reactions have changed; for bots only
case updateMessageReactions(UpdateMessageReactions)
private enum Kind: String, Codable {
case updateAuthorizationState
case updateNewMessage
case updateMessageSendAcknowledged
case updateMessageSendSucceeded
case updateMessageSendFailed
case updateMessageContent
case updateMessageEdited
case updateMessageIsPinned
case updateMessageInteractionInfo
case updateMessageContentOpened
case updateMessageMentionRead
case updateMessageUnreadReactions
case updateMessageFactCheck
case updateMessageLiveLocationViewed
case updateNewChat
case updateChatTitle
case updateChatPhoto
case updateChatAccentColors
case updateChatPermissions
case updateChatLastMessage
case updateChatPosition
case updateChatAddedToList
case updateChatRemovedFromList
case updateChatReadInbox
case updateChatReadOutbox
case updateChatActionBar
case updateChatBusinessBotManageBar
case updateChatAvailableReactions
case updateChatDraftMessage
case updateChatEmojiStatus
case updateChatMessageSender
case updateChatMessageAutoDeleteTime
case updateChatNotificationSettings
case updateChatPendingJoinRequests
case updateChatReplyMarkup
case updateChatBackground
case updateChatTheme
case updateChatUnreadMentionCount
case updateChatUnreadReactionCount
case updateChatVideoChat
case updateChatDefaultDisableNotification
case updateChatHasProtectedContent
case updateChatIsTranslatable
case updateChatIsMarkedAsUnread
case updateChatViewAsTopics
case updateChatBlockList
case updateChatHasScheduledMessages
case updateChatFolders
case updateChatOnlineMemberCount
case updateSavedMessagesTopic
case updateSavedMessagesTopicCount
case updateQuickReplyShortcut
case updateQuickReplyShortcutDeleted
case updateQuickReplyShortcuts
case updateQuickReplyShortcutMessages
case updateForumTopicInfo
case updateScopeNotificationSettings
case updateReactionNotificationSettings
case updateNotification
case updateNotificationGroup
case updateActiveNotifications
case updateHavePendingNotifications
case updateDeleteMessages
case updateChatAction
case updateUserStatus
case updateUser
case updateBasicGroup
case updateSupergroup
case updateSecretChat
case updateUserFullInfo
case updateBasicGroupFullInfo
case updateSupergroupFullInfo
case updateServiceNotification
case updateFile
case updateFileGenerationStart
case updateFileGenerationStop
case updateFileDownloads
case updateFileAddedToDownloads
case updateFileDownload
case updateFileRemovedFromDownloads
case updateApplicationVerificationRequired
case updateCall
case updateGroupCall
case updateGroupCallParticipant
case updateNewCallSignalingData
case updateUserPrivacySettingRules
case updateUnreadMessageCount
case updateUnreadChatCount
case updateStory
case updateStoryDeleted
case updateStorySendSucceeded
case updateStorySendFailed
case updateChatActiveStories
case updateStoryListChatCount
case updateStoryStealthMode
case updateOption
case updateStickerSet
case updateInstalledStickerSets
case updateTrendingStickerSets
case updateRecentStickers
case updateFavoriteStickers
case updateSavedAnimations
case updateSavedNotificationSounds
case updateDefaultBackground
case updateChatThemes
case updateAccentColors
case updateProfileAccentColors
case updateLanguagePackStrings
case updateConnectionState
case updateTermsOfService
case updateUsersNearby
case updateUnconfirmedSession
case updateAttachmentMenuBots
case updateWebAppMessageSent
case updateActiveEmojiReactions
case updateAvailableMessageEffects
case updateDefaultReactionType
case updateSavedMessagesTags
case updateOwnedStarCount
case updateChatRevenueAmount
case updateStarRevenueStatus
case updateSpeechRecognitionTrial
case updateDiceEmojis
case updateAnimatedEmojiMessageClicked
case updateAnimationSearchParameters
case updateSuggestedActions
case updateSpeedLimitNotification
case updateContactCloseBirthdays
case updateAutosaveSettings
case updateBusinessConnection
case updateNewBusinessMessage
case updateBusinessMessageEdited
case updateBusinessMessagesDeleted
case updateNewInlineQuery
case updateNewChosenInlineResult
case updateNewCallbackQuery
case updateNewInlineCallbackQuery
case updateNewBusinessCallbackQuery
case updateNewShippingQuery
case updateNewPreCheckoutQuery
case updateNewCustomEvent
case updateNewCustomQuery
case updatePoll
case updatePollAnswer
case updateChatMember
case updateNewChatJoinRequest
case updateChatBoost
case updateMessageReaction
case updateMessageReactions
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
let type = try container.decode(Kind.self, forKey: .type)
switch type {
case .updateAuthorizationState:
let value = try UpdateAuthorizationState(from: decoder)
self = .updateAuthorizationState(value)
case .updateNewMessage:
let value = try UpdateNewMessage(from: decoder)
self = .updateNewMessage(value)
case .updateMessageSendAcknowledged:
let value = try UpdateMessageSendAcknowledged(from: decoder)
self = .updateMessageSendAcknowledged(value)
case .updateMessageSendSucceeded:
let value = try UpdateMessageSendSucceeded(from: decoder)
self = .updateMessageSendSucceeded(value)
case .updateMessageSendFailed:
let value = try UpdateMessageSendFailed(from: decoder)
self = .updateMessageSendFailed(value)
case .updateMessageContent:
let value = try UpdateMessageContent(from: decoder)
self = .updateMessageContent(value)
case .updateMessageEdited:
let value = try UpdateMessageEdited(from: decoder)
self = .updateMessageEdited(value)
case .updateMessageIsPinned:
let value = try UpdateMessageIsPinned(from: decoder)
self = .updateMessageIsPinned(value)
case .updateMessageInteractionInfo:
let value = try UpdateMessageInteractionInfo(from: decoder)
self = .updateMessageInteractionInfo(value)
case .updateMessageContentOpened:
let value = try UpdateMessageContentOpened(from: decoder)
self = .updateMessageContentOpened(value)
case .updateMessageMentionRead:
let value = try UpdateMessageMentionRead(from: decoder)
self = .updateMessageMentionRead(value)
case .updateMessageUnreadReactions:
let value = try UpdateMessageUnreadReactions(from: decoder)
self = .updateMessageUnreadReactions(value)
case .updateMessageFactCheck:
let value = try UpdateMessageFactCheck(from: decoder)
self = .updateMessageFactCheck(value)
case .updateMessageLiveLocationViewed:
let value = try UpdateMessageLiveLocationViewed(from: decoder)
self = .updateMessageLiveLocationViewed(value)
case .updateNewChat:
let value = try UpdateNewChat(from: decoder)
self = .updateNewChat(value)
case .updateChatTitle:
let value = try UpdateChatTitle(from: decoder)
self = .updateChatTitle(value)
case .updateChatPhoto:
let value = try UpdateChatPhoto(from: decoder)
self = .updateChatPhoto(value)
case .updateChatAccentColors:
let value = try UpdateChatAccentColors(from: decoder)
self = .updateChatAccentColors(value)
case .updateChatPermissions:
let value = try UpdateChatPermissions(from: decoder)
self = .updateChatPermissions(value)
case .updateChatLastMessage:
let value = try UpdateChatLastMessage(from: decoder)
self = .updateChatLastMessage(value)
case .updateChatPosition:
let value = try UpdateChatPosition(from: decoder)
self = .updateChatPosition(value)
case .updateChatAddedToList:
let value = try UpdateChatAddedToList(from: decoder)
self = .updateChatAddedToList(value)
case .updateChatRemovedFromList:
let value = try UpdateChatRemovedFromList(from: decoder)
self = .updateChatRemovedFromList(value)
case .updateChatReadInbox:
let value = try UpdateChatReadInbox(from: decoder)
self = .updateChatReadInbox(value)
case .updateChatReadOutbox:
let value = try UpdateChatReadOutbox(from: decoder)
self = .updateChatReadOutbox(value)
case .updateChatActionBar:
let value = try UpdateChatActionBar(from: decoder)
self = .updateChatActionBar(value)
case .updateChatBusinessBotManageBar:
let value = try UpdateChatBusinessBotManageBar(from: decoder)
self = .updateChatBusinessBotManageBar(value)
case .updateChatAvailableReactions:
let value = try UpdateChatAvailableReactions(from: decoder)
self = .updateChatAvailableReactions(value)
case .updateChatDraftMessage:
let value = try UpdateChatDraftMessage(from: decoder)
self = .updateChatDraftMessage(value)
case .updateChatEmojiStatus:
let value = try UpdateChatEmojiStatus(from: decoder)
self = .updateChatEmojiStatus(value)
case .updateChatMessageSender:
let value = try UpdateChatMessageSender(from: decoder)
self = .updateChatMessageSender(value)
case .updateChatMessageAutoDeleteTime:
let value = try UpdateChatMessageAutoDeleteTime(from: decoder)
self = .updateChatMessageAutoDeleteTime(value)
case .updateChatNotificationSettings:
let value = try UpdateChatNotificationSettings(from: decoder)
self = .updateChatNotificationSettings(value)
case .updateChatPendingJoinRequests:
let value = try UpdateChatPendingJoinRequests(from: decoder)
self = .updateChatPendingJoinRequests(value)
case .updateChatReplyMarkup:
let value = try UpdateChatReplyMarkup(from: decoder)
self = .updateChatReplyMarkup(value)
case .updateChatBackground:
let value = try UpdateChatBackground(from: decoder)
self = .updateChatBackground(value)
case .updateChatTheme:
let value = try UpdateChatTheme(from: decoder)
self = .updateChatTheme(value)
case .updateChatUnreadMentionCount:
let value = try UpdateChatUnreadMentionCount(from: decoder)
self = .updateChatUnreadMentionCount(value)
case .updateChatUnreadReactionCount:
let value = try UpdateChatUnreadReactionCount(from: decoder)
self = .updateChatUnreadReactionCount(value)
case .updateChatVideoChat:
let value = try UpdateChatVideoChat(from: decoder)
self = .updateChatVideoChat(value)
case .updateChatDefaultDisableNotification:
let value = try UpdateChatDefaultDisableNotification(from: decoder)
self = .updateChatDefaultDisableNotification(value)
case .updateChatHasProtectedContent:
let value = try UpdateChatHasProtectedContent(from: decoder)
self = .updateChatHasProtectedContent(value)
case .updateChatIsTranslatable:
let value = try UpdateChatIsTranslatable(from: decoder)
self = .updateChatIsTranslatable(value)
case .updateChatIsMarkedAsUnread:
let value = try UpdateChatIsMarkedAsUnread(from: decoder)
self = .updateChatIsMarkedAsUnread(value)
case .updateChatViewAsTopics:
let value = try UpdateChatViewAsTopics(from: decoder)
self = .updateChatViewAsTopics(value)
case .updateChatBlockList:
let value = try UpdateChatBlockList(from: decoder)
self = .updateChatBlockList(value)
case .updateChatHasScheduledMessages:
let value = try UpdateChatHasScheduledMessages(from: decoder)
self = .updateChatHasScheduledMessages(value)
case .updateChatFolders:
let value = try UpdateChatFolders(from: decoder)
self = .updateChatFolders(value)
case .updateChatOnlineMemberCount:
let value = try UpdateChatOnlineMemberCount(from: decoder)
self = .updateChatOnlineMemberCount(value)
case .updateSavedMessagesTopic:
let value = try UpdateSavedMessagesTopic(from: decoder)
self = .updateSavedMessagesTopic(value)
case .updateSavedMessagesTopicCount:
let value = try UpdateSavedMessagesTopicCount(from: decoder)
self = .updateSavedMessagesTopicCount(value)
case .updateQuickReplyShortcut:
let value = try UpdateQuickReplyShortcut(from: decoder)
self = .updateQuickReplyShortcut(value)
case .updateQuickReplyShortcutDeleted:
let value = try UpdateQuickReplyShortcutDeleted(from: decoder)
self = .updateQuickReplyShortcutDeleted(value)
case .updateQuickReplyShortcuts:
let value = try UpdateQuickReplyShortcuts(from: decoder)
self = .updateQuickReplyShortcuts(value)
case .updateQuickReplyShortcutMessages:
let value = try UpdateQuickReplyShortcutMessages(from: decoder)
self = .updateQuickReplyShortcutMessages(value)
case .updateForumTopicInfo:
let value = try UpdateForumTopicInfo(from: decoder)
self = .updateForumTopicInfo(value)
case .updateScopeNotificationSettings:
let value = try UpdateScopeNotificationSettings(from: decoder)
self = .updateScopeNotificationSettings(value)
case .updateReactionNotificationSettings:
let value = try UpdateReactionNotificationSettings(from: decoder)
self = .updateReactionNotificationSettings(value)
case .updateNotification:
let value = try UpdateNotification(from: decoder)
self = .updateNotification(value)
case .updateNotificationGroup:
let value = try UpdateNotificationGroup(from: decoder)
self = .updateNotificationGroup(value)
case .updateActiveNotifications:
let value = try UpdateActiveNotifications(from: decoder)
self = .updateActiveNotifications(value)
case .updateHavePendingNotifications:
let value = try UpdateHavePendingNotifications(from: decoder)
self = .updateHavePendingNotifications(value)
case .updateDeleteMessages:
let value = try UpdateDeleteMessages(from: decoder)
self = .updateDeleteMessages(value)
case .updateChatAction:
let value = try UpdateChatAction(from: decoder)
self = .updateChatAction(value)
case .updateUserStatus:
let value = try UpdateUserStatus(from: decoder)
self = .updateUserStatus(value)
case .updateUser:
let value = try UpdateUser(from: decoder)
self = .updateUser(value)
case .updateBasicGroup:
let value = try UpdateBasicGroup(from: decoder)
self = .updateBasicGroup(value)
case .updateSupergroup:
let value = try UpdateSupergroup(from: decoder)
self = .updateSupergroup(value)
case .updateSecretChat:
let value = try UpdateSecretChat(from: decoder)
self = .updateSecretChat(value)
case .updateUserFullInfo:
let value = try UpdateUserFullInfo(from: decoder)
self = .updateUserFullInfo(value)
case .updateBasicGroupFullInfo:
let value = try UpdateBasicGroupFullInfo(from: decoder)
self = .updateBasicGroupFullInfo(value)
case .updateSupergroupFullInfo:
let value = try UpdateSupergroupFullInfo(from: decoder)
self = .updateSupergroupFullInfo(value)
case .updateServiceNotification:
let value = try UpdateServiceNotification(from: decoder)
self = .updateServiceNotification(value)
case .updateFile:
let value = try UpdateFile(from: decoder)
self = .updateFile(value)
case .updateFileGenerationStart:
let value = try UpdateFileGenerationStart(from: decoder)
self = .updateFileGenerationStart(value)
case .updateFileGenerationStop:
let value = try UpdateFileGenerationStop(from: decoder)
self = .updateFileGenerationStop(value)
case .updateFileDownloads:
let value = try UpdateFileDownloads(from: decoder)
self = .updateFileDownloads(value)
case .updateFileAddedToDownloads:
let value = try UpdateFileAddedToDownloads(from: decoder)
self = .updateFileAddedToDownloads(value)
case .updateFileDownload:
let value = try UpdateFileDownload(from: decoder)
self = .updateFileDownload(value)
case .updateFileRemovedFromDownloads:
let value = try UpdateFileRemovedFromDownloads(from: decoder)
self = .updateFileRemovedFromDownloads(value)
case .updateApplicationVerificationRequired:
let value = try UpdateApplicationVerificationRequired(from: decoder)
self = .updateApplicationVerificationRequired(value)
case .updateCall:
let value = try UpdateCall(from: decoder)
self = .updateCall(value)
case .updateGroupCall:
let value = try UpdateGroupCall(from: decoder)
self = .updateGroupCall(value)
case .updateGroupCallParticipant:
let value = try UpdateGroupCallParticipant(from: decoder)
self = .updateGroupCallParticipant(value)
case .updateNewCallSignalingData:
let value = try UpdateNewCallSignalingData(from: decoder)
self = .updateNewCallSignalingData(value)
case .updateUserPrivacySettingRules:
let value = try UpdateUserPrivacySettingRules(from: decoder)
self = .updateUserPrivacySettingRules(value)
case .updateUnreadMessageCount:
let value = try UpdateUnreadMessageCount(from: decoder)
self = .updateUnreadMessageCount(value)
case .updateUnreadChatCount:
let value = try UpdateUnreadChatCount(from: decoder)
self = .updateUnreadChatCount(value)
case .updateStory:
let value = try UpdateStory(from: decoder)
self = .updateStory(value)
case .updateStoryDeleted:
let value = try UpdateStoryDeleted(from: decoder)
self = .updateStoryDeleted(value)
case .updateStorySendSucceeded:
let value = try UpdateStorySendSucceeded(from: decoder)
self = .updateStorySendSucceeded(value)
case .updateStorySendFailed:
let value = try UpdateStorySendFailed(from: decoder)
self = .updateStorySendFailed(value)
case .updateChatActiveStories:
let value = try UpdateChatActiveStories(from: decoder)
self = .updateChatActiveStories(value)
case .updateStoryListChatCount:
let value = try UpdateStoryListChatCount(from: decoder)
self = .updateStoryListChatCount(value)
case .updateStoryStealthMode:
let value = try UpdateStoryStealthMode(from: decoder)
self = .updateStoryStealthMode(value)
case .updateOption:
let value = try UpdateOption(from: decoder)
self = .updateOption(value)
case .updateStickerSet:
let value = try UpdateStickerSet(from: decoder)
self = .updateStickerSet(value)
case .updateInstalledStickerSets:
let value = try UpdateInstalledStickerSets(from: decoder)
self = .updateInstalledStickerSets(value)
case .updateTrendingStickerSets:
let value = try UpdateTrendingStickerSets(from: decoder)
self = .updateTrendingStickerSets(value)
case .updateRecentStickers:
let value = try UpdateRecentStickers(from: decoder)
self = .updateRecentStickers(value)
case .updateFavoriteStickers:
let value = try UpdateFavoriteStickers(from: decoder)
self = .updateFavoriteStickers(value)
case .updateSavedAnimations:
let value = try UpdateSavedAnimations(from: decoder)
self = .updateSavedAnimations(value)
case .updateSavedNotificationSounds:
let value = try UpdateSavedNotificationSounds(from: decoder)
self = .updateSavedNotificationSounds(value)
case .updateDefaultBackground:
let value = try UpdateDefaultBackground(from: decoder)
self = .updateDefaultBackground(value)
case .updateChatThemes:
let value = try UpdateChatThemes(from: decoder)
self = .updateChatThemes(value)
case .updateAccentColors:
let value = try UpdateAccentColors(from: decoder)
self = .updateAccentColors(value)
case .updateProfileAccentColors:
let value = try UpdateProfileAccentColors(from: decoder)
self = .updateProfileAccentColors(value)