gotd: update to layer 224
This commit is contained in:
@@ -797,8 +797,9 @@ func convertPoll(media tg.MessageMediaClass) *bridgev2.ConvertedMessagePart {
|
||||
var textAnswers []string
|
||||
var htmlAnswers strings.Builder
|
||||
for i, opt := range poll.Poll.Answers {
|
||||
textAnswers = append(textAnswers, fmt.Sprintf("%d. %s", i+1, opt.Text.Text))
|
||||
htmlAnswers.WriteString(fmt.Sprintf("<li>%s</li>", opt.Text.Text))
|
||||
text := opt.GetText()
|
||||
textAnswers = append(textAnswers, fmt.Sprintf("%d. %s", i+1, text.Text))
|
||||
htmlAnswers.WriteString(fmt.Sprintf("<li>%s</li>", text.Text))
|
||||
}
|
||||
|
||||
return &bridgev2.ConvertedMessagePart{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by ./cmd/dltl, DO NOT EDIT.
|
||||
//
|
||||
// Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl
|
||||
// Layer: 223
|
||||
// SHA256: efb4626bec87841fc0736a74e02bfd4e8bfbff001cab309246195af4897e6602
|
||||
// Layer: 224
|
||||
// SHA256: 44b4a8cced28a25e13fcb2bfd34983e6b906414f42dc04bbd0e3dded9253331d
|
||||
|
||||
boolFalse#bc799737 = Bool;
|
||||
|
||||
@@ -46,9 +46,9 @@ inputFileStoryDocument#62dc8b48 id:InputDocument = InputFile;
|
||||
|
||||
inputMediaEmpty#9664f57f = InputMedia;
|
||||
|
||||
inputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
|
||||
inputMediaUploadedPhoto#7d8375da flags:# spoiler:flags.2?true live_photo:flags.3?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int video:flags.3?InputDocument = InputMedia;
|
||||
|
||||
inputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaPhoto#e3af4434 flags:# spoiler:flags.1?true live_photo:flags.2?true id:InputPhoto ttl_seconds:flags.0?int video:flags.2?InputDocument = InputMedia;
|
||||
|
||||
inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
|
||||
|
||||
@@ -70,7 +70,7 @@ inputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0
|
||||
|
||||
inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
|
||||
|
||||
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
||||
inputMediaPoll#883a4108 flags:# poll:Poll correct_answers:flags.0?Vector<int> attached_media:flags.3?InputMedia solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> solution_media:flags.2?InputMedia = InputMedia;
|
||||
|
||||
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
|
||||
|
||||
@@ -146,7 +146,7 @@ storage.fileWebp#1081464c = storage.FileType;
|
||||
|
||||
userEmpty#d3bc4b7a id:long = User;
|
||||
|
||||
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
|
||||
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true bot_can_manage_bots:flags2.18?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
|
||||
@@ -200,7 +200,7 @@ messageService#7a800e0a flags:# out:flags.1?true mentioned:flags.4?true media_un
|
||||
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
|
||||
messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
||||
messageMediaPhoto#e216eb63 flags:# spoiler:flags.3?true live_photo:flags.4?true photo:flags.0?Photo ttl_seconds:flags.2?int video:flags.4?Document = MessageMedia;
|
||||
|
||||
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
|
||||
|
||||
@@ -220,7 +220,7 @@ messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true tes
|
||||
|
||||
messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
|
||||
|
||||
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
|
||||
messageMediaPoll#773f4e66 flags:# poll:Poll results:PollResults attached_media:flags.0?MessageMedia = MessageMedia;
|
||||
|
||||
messageMediaDice#8cbec07 flags:# value:int emoticon:string game_outcome:flags.0?messages.EmojiGameOutcome = MessageMedia;
|
||||
|
||||
@@ -364,7 +364,13 @@ messageActionNoForwardsToggle#bf7d6572 prev_value:Bool new_value:Bool = MessageA
|
||||
|
||||
messageActionNoForwardsRequest#3e2793ba flags:# expired:flags.0?true prev_value:Bool new_value:Bool = MessageAction;
|
||||
|
||||
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
messageActionPollAppendAnswer#9da1cd6c answer:PollAnswer = MessageAction;
|
||||
|
||||
messageActionPollDeleteAnswer#399674dc answer:PollAnswer = MessageAction;
|
||||
|
||||
messageActionManagedBotCreated#16605e3e bot_id:long = MessageAction;
|
||||
|
||||
dialog#fc89f7f3 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int unread_poll_votes_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
|
||||
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
||||
|
||||
@@ -440,7 +446,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
|
||||
|
||||
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
|
||||
|
||||
userFull#a02bc13e flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull;
|
||||
userFull#6cbe645 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?true unofficial_security_risk:flags2.26?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities bot_manager_id:flags2.25?long = UserFull;
|
||||
|
||||
contact#145ade0b user_id:long mutual:Bool = Contact;
|
||||
|
||||
@@ -514,6 +520,8 @@ inputMessagesFilterContacts#e062db83 = MessagesFilter;
|
||||
|
||||
inputMessagesFilterPinned#1bb00451 = MessagesFilter;
|
||||
|
||||
inputMessagesFilterPoll#fa2bc90a = MessagesFilter;
|
||||
|
||||
updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
|
||||
|
||||
updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
||||
@@ -638,7 +646,7 @@ updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = U
|
||||
|
||||
updateDialogUnreadMark#b658f23e flags:# unread:flags.0?true peer:DialogPeer saved_peer_id:flags.1?Peer = Update;
|
||||
|
||||
updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
|
||||
updateMessagePoll#d64c522b flags:# peer:flags.1?Peer msg_id:flags.1?int top_msg_id:flags.2?int poll_id:long poll:flags.0?Poll results:PollResults = Update;
|
||||
|
||||
updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
|
||||
|
||||
@@ -658,7 +666,7 @@ updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
|
||||
|
||||
updateLoginToken#564fe691 = Update;
|
||||
|
||||
updateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector<bytes> qts:int = Update;
|
||||
updateMessagePollVote#7699f014 poll_id:long peer:Peer options:Vector<bytes> positions:Vector<int> qts:int = Update;
|
||||
|
||||
updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
|
||||
|
||||
@@ -820,6 +828,8 @@ updateStarGiftCraftFail#ac072444 = Update;
|
||||
|
||||
updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version:int = Update;
|
||||
|
||||
updateManagedBot#4880ed9a user_id:long bot_id:long qts:int = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;
|
||||
@@ -1254,6 +1264,12 @@ messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int lengt
|
||||
|
||||
messageEntityFormattedDate#904ac7c7 flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true offset:int length:int date:int = MessageEntity;
|
||||
|
||||
messageEntityDiffInsert#71777116 offset:int length:int = MessageEntity;
|
||||
|
||||
messageEntityDiffReplace#c6c1e5a7 offset:int length:int old_text:string = MessageEntity;
|
||||
|
||||
messageEntityDiffDelete#652c1c5 offset:int length:int = MessageEntity;
|
||||
|
||||
inputChannelEmpty#ee8c1e86 = InputChannel;
|
||||
|
||||
inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel;
|
||||
@@ -1980,13 +1996,15 @@ help.userInfoEmpty#f3ae2eed = help.UserInfo;
|
||||
|
||||
help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
|
||||
|
||||
pollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer;
|
||||
pollAnswer#4b7d786a flags:# text:TextWithEntities option:bytes media:flags.0?MessageMedia added_by:flags.1?Peer date:flags.1?int = PollAnswer;
|
||||
|
||||
poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
|
||||
inputPollAnswer#199fed96 flags:# text:TextWithEntities media:flags.0?InputMedia = PollAnswer;
|
||||
|
||||
pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
|
||||
poll#b8425be9 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true open_answers:flags.6?true revoting_disabled:flags.7?true shuffle_answers:flags.8?true hide_results_until_close:flags.9?true creator:flags.10?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int hash:long = Poll;
|
||||
|
||||
pollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;
|
||||
pollAnswerVoters#3645230a flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:flags.2?int recent_voters:flags.2?Vector<Peer> = PollAnswerVoters;
|
||||
|
||||
pollResults#ba7bb15e flags:# min:flags.0?true has_unread_votes:flags.6?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> solution_media:flags.5?MessageMedia = PollResults;
|
||||
|
||||
chatOnlines#f041e250 onlines:int = ChatOnlines;
|
||||
|
||||
@@ -2032,7 +2050,7 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;
|
||||
|
||||
messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;
|
||||
|
||||
urlAuthResultRequest#f8f8eb1e flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector<string> user_id_hint:flags.4?long = UrlAuthResult;
|
||||
urlAuthResultRequest#3cd623ec flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true is_app:flags.6?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector<string> user_id_hint:flags.4?long verified_app_name:flags.7?string = UrlAuthResult;
|
||||
|
||||
urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult;
|
||||
|
||||
@@ -2156,7 +2174,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
|
||||
|
||||
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||
|
||||
messageReplyHeader#6917560b flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int todo_item_id:flags.11?int = MessageReplyHeader;
|
||||
messageReplyHeader#1b97dd66 flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int todo_item_id:flags.11?int poll_option:flags.12?bytes = MessageReplyHeader;
|
||||
|
||||
messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader;
|
||||
|
||||
@@ -2458,7 +2476,7 @@ username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:str
|
||||
|
||||
forumTopicDeleted#23f109b id:int = ForumTopic;
|
||||
|
||||
forumTopic#cdff0eca flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true title_missing:flags.7?true id:int date:int peer:Peer title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
forumTopic#fcdad815 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true title_missing:flags.7?true id:int date:int peer:Peer title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int unread_poll_votes_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
|
||||
messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics;
|
||||
|
||||
@@ -2472,6 +2490,8 @@ requestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.
|
||||
|
||||
requestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType;
|
||||
|
||||
requestPeerTypeCreateBot#3e81e078 flags:# bot_managed:flags.0?true suggested_name:flags.1?string suggested_username:flags.2?string = RequestPeerType;
|
||||
|
||||
emojiListNotModified#481eadfa = EmojiList;
|
||||
|
||||
emojiList#7a1e11d1 hash:long document_id:Vector<long> = EmojiList;
|
||||
@@ -2542,7 +2562,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem;
|
||||
|
||||
storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true live:flags.9?true id:int date:int expire_date:int = StoryItem;
|
||||
|
||||
storyItem#edf164f1 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction albums:flags.19?Vector<int> = StoryItem;
|
||||
storyItem#16a4b93c flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction albums:flags.19?Vector<int> music:flags.20?Document = StoryItem;
|
||||
|
||||
stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories;
|
||||
|
||||
@@ -2560,7 +2580,7 @@ stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count
|
||||
|
||||
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
||||
|
||||
inputReplyToMessage#869fbe10 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer todo_item_id:flags.6?int = InputReplyTo;
|
||||
inputReplyToMessage#3bd4b7c2 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer todo_item_id:flags.6?int poll_option:flags.7?bytes = InputReplyTo;
|
||||
|
||||
inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo;
|
||||
|
||||
@@ -2780,7 +2800,7 @@ reactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom;
|
||||
|
||||
reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom;
|
||||
|
||||
reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings;
|
||||
reactionsNotifySettings#71e4ea58 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom poll_votes_notify_from:flags.2?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings;
|
||||
|
||||
availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect;
|
||||
|
||||
@@ -3094,6 +3114,14 @@ starGiftAttributeRarityLegendary#cef7e7a8 = StarGiftAttributeRarity;
|
||||
|
||||
keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle;
|
||||
|
||||
inputMessageReadMetric#402b4495 msg_id:int view_id:long time_in_view_ms:int active_time_in_view_ms:int height_to_viewport_ratio_permille:int seen_range_ratio_permille:int = InputMessageReadMetric;
|
||||
|
||||
bots.exportedBotToken#3c60b621 token:string = bots.ExportedBotToken;
|
||||
|
||||
bots.requestedButton#f13bbcd7 webapp_req_id:string = bots.RequestedButton;
|
||||
|
||||
messages.composedMessageWithAI#90d7adfa flags:# result_text:TextWithEntities diff_text:flags.0?TextWithEntities = messages.ComposedMessageWithAI;
|
||||
|
||||
|
||||
---functions---
|
||||
|
||||
@@ -3683,7 +3711,7 @@ messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?
|
||||
|
||||
messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
|
||||
|
||||
messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
|
||||
messages.getPollResults#eda3e33b peer:InputPeer msg_id:int poll_hash:long = Updates;
|
||||
|
||||
messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
|
||||
|
||||
@@ -3795,7 +3823,7 @@ messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
|
||||
|
||||
messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool;
|
||||
|
||||
messages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string = messages.TranslatedText;
|
||||
messages.translateText#a5eec345 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string tone:flags.2?string = messages.TranslatedText;
|
||||
|
||||
messages.getUnreadReactions#bd7f90ac flags:# peer:InputPeer top_msg_id:flags.0?int saved_peer_id:flags.1?InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
|
||||
@@ -3843,7 +3871,7 @@ messages.setDefaultHistoryTTL#9eb51445 period:int = Bool;
|
||||
|
||||
messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL;
|
||||
|
||||
messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector<InputPeer> = Updates;
|
||||
messages.sendBotRequestedPeer#6c5cf2a7 flags:# peer:InputPeer msg_id:flags.0?int webapp_req_id:flags.1?string button_id:int requested_peers:Vector<InputPeer> = Updates;
|
||||
|
||||
messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups;
|
||||
|
||||
@@ -3963,7 +3991,7 @@ messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.Af
|
||||
|
||||
messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo;
|
||||
|
||||
messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities;
|
||||
messages.summarizeText#abbbd346 flags:# peer:InputPeer id:int to_lang:flags.0?string tone:flags.2?string = TextWithEntities;
|
||||
|
||||
messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates;
|
||||
|
||||
@@ -3975,6 +4003,20 @@ messages.declineUrlAuth#35436bbc url:string = Bool;
|
||||
|
||||
messages.checkUrlAuthMatchCode#c9a47b0b url:string match_code:string = Bool;
|
||||
|
||||
messages.composeMessageWithAI#fd426afe flags:# proofread:flags.0?true emojify:flags.3?true text:TextWithEntities translate_to_lang:flags.1?string change_tone:flags.2?string = messages.ComposedMessageWithAI;
|
||||
|
||||
messages.reportReadMetrics#4067c5e6 peer:InputPeer metrics:Vector<InputMessageReadMetric> = Bool;
|
||||
|
||||
messages.reportMusicListen#ddbcd819 id:InputDocument listened_duration:int = Bool;
|
||||
|
||||
messages.addPollAnswer#19bc4b6d peer:InputPeer msg_id:int answer:PollAnswer = Updates;
|
||||
|
||||
messages.deletePollAnswer#ac8505a5 peer:InputPeer msg_id:int option:bytes = Updates;
|
||||
|
||||
messages.getUnreadPollVotes#43286cf2 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
|
||||
messages.readPollVotes#1720b4d8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
|
||||
updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference;
|
||||
@@ -4233,6 +4275,16 @@ bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?Inp
|
||||
|
||||
bots.getBotRecommendations#a1b70815 bot:InputUser = users.Users;
|
||||
|
||||
bots.checkUsername#87f2219b username:string = Bool;
|
||||
|
||||
bots.createBot#e5b17f2b flags:# via_deeplink:flags.0?true name:string username:string manager_id:InputUser = User;
|
||||
|
||||
bots.exportBotToken#bd0d99eb bot:InputUser revoke:Bool = bots.ExportedBotToken;
|
||||
|
||||
bots.requestWebViewButton#31a2a35e user_id:InputUser button:KeyboardButton = bots.RequestedButton;
|
||||
|
||||
bots.getRequestedWebViewButton#bf25b7f3 bot:InputUser webapp_req_id:string = KeyboardButton;
|
||||
|
||||
payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;
|
||||
|
||||
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
|
||||
@@ -4329,7 +4381,7 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<Inpu
|
||||
|
||||
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
|
||||
|
||||
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
||||
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true stars_only:flags.5?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
||||
|
||||
payments.updateStarGiftPrice#edbe6ccb stargift:InputSavedStarGift resell_amount:StarsAmount = Updates;
|
||||
|
||||
@@ -4521,9 +4573,9 @@ chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer>
|
||||
|
||||
stories.canSendStory#30eb63f0 peer:InputPeer = stories.CanSendStoryCount;
|
||||
|
||||
stories.sendStory#737fc2ec flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int albums:flags.8?Vector<int> = Updates;
|
||||
stories.sendStory#8f9e6898 flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int albums:flags.8?Vector<int> music:flags.9?InputDocument = Updates;
|
||||
|
||||
stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates;
|
||||
stories.editStory#2c63a72b flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> music:flags.4?InputDocument = Updates;
|
||||
|
||||
stories.deleteStories#ae59db5f peer:InputPeer id:Vector<int> = Vector<int>;
|
||||
|
||||
@@ -4611,4 +4663,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
|
||||
|
||||
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
|
||||
|
||||
// LAYER 223
|
||||
// LAYER 224
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//
|
||||
// Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl
|
||||
// Merge: _schema/legacy.tl
|
||||
// Layer: 223
|
||||
// SHA256: efb4626bec87841fc0736a74e02bfd4e8bfbff001cab309246195af4897e6602
|
||||
// Layer: 224
|
||||
// SHA256: 44b4a8cced28a25e13fcb2bfd34983e6b906414f42dc04bbd0e3dded9253331d
|
||||
|
||||
boolFalse#bc799737 = Bool;
|
||||
|
||||
@@ -47,9 +47,9 @@ inputFileStoryDocument#62dc8b48 id:InputDocument = InputFile;
|
||||
|
||||
inputMediaEmpty#9664f57f = InputMedia;
|
||||
|
||||
inputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
|
||||
inputMediaUploadedPhoto#7d8375da flags:# spoiler:flags.2?true live_photo:flags.3?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int video:flags.3?InputDocument = InputMedia;
|
||||
|
||||
inputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaPhoto#e3af4434 flags:# spoiler:flags.1?true live_photo:flags.2?true id:InputPhoto ttl_seconds:flags.0?int video:flags.2?InputDocument = InputMedia;
|
||||
|
||||
inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
|
||||
|
||||
@@ -71,7 +71,7 @@ inputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0
|
||||
|
||||
inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
|
||||
|
||||
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
||||
inputMediaPoll#883a4108 flags:# poll:Poll correct_answers:flags.0?Vector<int> attached_media:flags.3?InputMedia solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> solution_media:flags.2?InputMedia = InputMedia;
|
||||
|
||||
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
|
||||
|
||||
@@ -147,7 +147,7 @@ storage.fileWebp#1081464c = storage.FileType;
|
||||
|
||||
userEmpty#d3bc4b7a id:long = User;
|
||||
|
||||
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
|
||||
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true bot_can_manage_bots:flags2.18?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
|
||||
@@ -201,7 +201,7 @@ messageService#7a800e0a flags:# out:flags.1?true mentioned:flags.4?true media_un
|
||||
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
|
||||
messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
||||
messageMediaPhoto#e216eb63 flags:# spoiler:flags.3?true live_photo:flags.4?true photo:flags.0?Photo ttl_seconds:flags.2?int video:flags.4?Document = MessageMedia;
|
||||
|
||||
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
|
||||
|
||||
@@ -221,7 +221,7 @@ messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true tes
|
||||
|
||||
messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
|
||||
|
||||
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
|
||||
messageMediaPoll#773f4e66 flags:# poll:Poll results:PollResults attached_media:flags.0?MessageMedia = MessageMedia;
|
||||
|
||||
messageMediaDice#8cbec07 flags:# value:int emoticon:string game_outcome:flags.0?messages.EmojiGameOutcome = MessageMedia;
|
||||
|
||||
@@ -365,7 +365,13 @@ messageActionNoForwardsToggle#bf7d6572 prev_value:Bool new_value:Bool = MessageA
|
||||
|
||||
messageActionNoForwardsRequest#3e2793ba flags:# expired:flags.0?true prev_value:Bool new_value:Bool = MessageAction;
|
||||
|
||||
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
messageActionPollAppendAnswer#9da1cd6c answer:PollAnswer = MessageAction;
|
||||
|
||||
messageActionPollDeleteAnswer#399674dc answer:PollAnswer = MessageAction;
|
||||
|
||||
messageActionManagedBotCreated#16605e3e bot_id:long = MessageAction;
|
||||
|
||||
dialog#fc89f7f3 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int unread_poll_votes_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
|
||||
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
||||
|
||||
@@ -441,7 +447,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
|
||||
|
||||
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
|
||||
|
||||
userFull#a02bc13e flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull;
|
||||
userFull#6cbe645 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?true unofficial_security_risk:flags2.26?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities bot_manager_id:flags2.25?long = UserFull;
|
||||
|
||||
contact#145ade0b user_id:long mutual:Bool = Contact;
|
||||
|
||||
@@ -515,6 +521,8 @@ inputMessagesFilterContacts#e062db83 = MessagesFilter;
|
||||
|
||||
inputMessagesFilterPinned#1bb00451 = MessagesFilter;
|
||||
|
||||
inputMessagesFilterPoll#fa2bc90a = MessagesFilter;
|
||||
|
||||
updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
|
||||
|
||||
updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
||||
@@ -639,7 +647,7 @@ updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = U
|
||||
|
||||
updateDialogUnreadMark#b658f23e flags:# unread:flags.0?true peer:DialogPeer saved_peer_id:flags.1?Peer = Update;
|
||||
|
||||
updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
|
||||
updateMessagePoll#d64c522b flags:# peer:flags.1?Peer msg_id:flags.1?int top_msg_id:flags.2?int poll_id:long poll:flags.0?Poll results:PollResults = Update;
|
||||
|
||||
updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
|
||||
|
||||
@@ -659,7 +667,7 @@ updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
|
||||
|
||||
updateLoginToken#564fe691 = Update;
|
||||
|
||||
updateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector<bytes> qts:int = Update;
|
||||
updateMessagePollVote#7699f014 poll_id:long peer:Peer options:Vector<bytes> positions:Vector<int> qts:int = Update;
|
||||
|
||||
updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
|
||||
|
||||
@@ -821,6 +829,8 @@ updateStarGiftCraftFail#ac072444 = Update;
|
||||
|
||||
updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version:int = Update;
|
||||
|
||||
updateManagedBot#4880ed9a user_id:long bot_id:long qts:int = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;
|
||||
@@ -1255,6 +1265,12 @@ messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int lengt
|
||||
|
||||
messageEntityFormattedDate#904ac7c7 flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true offset:int length:int date:int = MessageEntity;
|
||||
|
||||
messageEntityDiffInsert#71777116 offset:int length:int = MessageEntity;
|
||||
|
||||
messageEntityDiffReplace#c6c1e5a7 offset:int length:int old_text:string = MessageEntity;
|
||||
|
||||
messageEntityDiffDelete#652c1c5 offset:int length:int = MessageEntity;
|
||||
|
||||
inputChannelEmpty#ee8c1e86 = InputChannel;
|
||||
|
||||
inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel;
|
||||
@@ -1981,13 +1997,15 @@ help.userInfoEmpty#f3ae2eed = help.UserInfo;
|
||||
|
||||
help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
|
||||
|
||||
pollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer;
|
||||
pollAnswer#4b7d786a flags:# text:TextWithEntities option:bytes media:flags.0?MessageMedia added_by:flags.1?Peer date:flags.1?int = PollAnswer;
|
||||
|
||||
poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
|
||||
inputPollAnswer#199fed96 flags:# text:TextWithEntities media:flags.0?InputMedia = PollAnswer;
|
||||
|
||||
pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
|
||||
poll#b8425be9 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true open_answers:flags.6?true revoting_disabled:flags.7?true shuffle_answers:flags.8?true hide_results_until_close:flags.9?true creator:flags.10?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int hash:long = Poll;
|
||||
|
||||
pollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;
|
||||
pollAnswerVoters#3645230a flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:flags.2?int recent_voters:flags.2?Vector<Peer> = PollAnswerVoters;
|
||||
|
||||
pollResults#ba7bb15e flags:# min:flags.0?true has_unread_votes:flags.6?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> solution_media:flags.5?MessageMedia = PollResults;
|
||||
|
||||
chatOnlines#f041e250 onlines:int = ChatOnlines;
|
||||
|
||||
@@ -2033,7 +2051,7 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;
|
||||
|
||||
messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;
|
||||
|
||||
urlAuthResultRequest#f8f8eb1e flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector<string> user_id_hint:flags.4?long = UrlAuthResult;
|
||||
urlAuthResultRequest#3cd623ec flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true is_app:flags.6?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector<string> user_id_hint:flags.4?long verified_app_name:flags.7?string = UrlAuthResult;
|
||||
|
||||
urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult;
|
||||
|
||||
@@ -2157,7 +2175,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
|
||||
|
||||
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||
|
||||
messageReplyHeader#6917560b flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int todo_item_id:flags.11?int = MessageReplyHeader;
|
||||
messageReplyHeader#1b97dd66 flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int todo_item_id:flags.11?int poll_option:flags.12?bytes = MessageReplyHeader;
|
||||
|
||||
messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader;
|
||||
|
||||
@@ -2459,7 +2477,7 @@ username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:str
|
||||
|
||||
forumTopicDeleted#23f109b id:int = ForumTopic;
|
||||
|
||||
forumTopic#cdff0eca flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true title_missing:flags.7?true id:int date:int peer:Peer title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
forumTopic#fcdad815 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true title_missing:flags.7?true id:int date:int peer:Peer title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int unread_poll_votes_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
|
||||
messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics;
|
||||
|
||||
@@ -2473,6 +2491,8 @@ requestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.
|
||||
|
||||
requestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType;
|
||||
|
||||
requestPeerTypeCreateBot#3e81e078 flags:# bot_managed:flags.0?true suggested_name:flags.1?string suggested_username:flags.2?string = RequestPeerType;
|
||||
|
||||
emojiListNotModified#481eadfa = EmojiList;
|
||||
|
||||
emojiList#7a1e11d1 hash:long document_id:Vector<long> = EmojiList;
|
||||
@@ -2543,7 +2563,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem;
|
||||
|
||||
storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true live:flags.9?true id:int date:int expire_date:int = StoryItem;
|
||||
|
||||
storyItem#edf164f1 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction albums:flags.19?Vector<int> = StoryItem;
|
||||
storyItem#16a4b93c flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction albums:flags.19?Vector<int> music:flags.20?Document = StoryItem;
|
||||
|
||||
stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories;
|
||||
|
||||
@@ -2561,7 +2581,7 @@ stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count
|
||||
|
||||
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
||||
|
||||
inputReplyToMessage#869fbe10 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer todo_item_id:flags.6?int = InputReplyTo;
|
||||
inputReplyToMessage#3bd4b7c2 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer todo_item_id:flags.6?int poll_option:flags.7?bytes = InputReplyTo;
|
||||
|
||||
inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo;
|
||||
|
||||
@@ -2781,7 +2801,7 @@ reactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom;
|
||||
|
||||
reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom;
|
||||
|
||||
reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings;
|
||||
reactionsNotifySettings#71e4ea58 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom poll_votes_notify_from:flags.2?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings;
|
||||
|
||||
availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect;
|
||||
|
||||
@@ -3095,6 +3115,14 @@ starGiftAttributeRarityLegendary#cef7e7a8 = StarGiftAttributeRarity;
|
||||
|
||||
keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle;
|
||||
|
||||
inputMessageReadMetric#402b4495 msg_id:int view_id:long time_in_view_ms:int active_time_in_view_ms:int height_to_viewport_ratio_permille:int seen_range_ratio_permille:int = InputMessageReadMetric;
|
||||
|
||||
bots.exportedBotToken#3c60b621 token:string = bots.ExportedBotToken;
|
||||
|
||||
bots.requestedButton#f13bbcd7 webapp_req_id:string = bots.RequestedButton;
|
||||
|
||||
messages.composedMessageWithAI#90d7adfa flags:# result_text:TextWithEntities diff_text:flags.0?TextWithEntities = messages.ComposedMessageWithAI;
|
||||
|
||||
|
||||
---functions---
|
||||
|
||||
@@ -3684,7 +3712,7 @@ messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?
|
||||
|
||||
messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
|
||||
|
||||
messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
|
||||
messages.getPollResults#eda3e33b peer:InputPeer msg_id:int poll_hash:long = Updates;
|
||||
|
||||
messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
|
||||
|
||||
@@ -3796,7 +3824,7 @@ messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
|
||||
|
||||
messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool;
|
||||
|
||||
messages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string = messages.TranslatedText;
|
||||
messages.translateText#a5eec345 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string tone:flags.2?string = messages.TranslatedText;
|
||||
|
||||
messages.getUnreadReactions#bd7f90ac flags:# peer:InputPeer top_msg_id:flags.0?int saved_peer_id:flags.1?InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
|
||||
@@ -3844,7 +3872,7 @@ messages.setDefaultHistoryTTL#9eb51445 period:int = Bool;
|
||||
|
||||
messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL;
|
||||
|
||||
messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector<InputPeer> = Updates;
|
||||
messages.sendBotRequestedPeer#6c5cf2a7 flags:# peer:InputPeer msg_id:flags.0?int webapp_req_id:flags.1?string button_id:int requested_peers:Vector<InputPeer> = Updates;
|
||||
|
||||
messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups;
|
||||
|
||||
@@ -3964,7 +3992,7 @@ messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.Af
|
||||
|
||||
messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo;
|
||||
|
||||
messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities;
|
||||
messages.summarizeText#abbbd346 flags:# peer:InputPeer id:int to_lang:flags.0?string tone:flags.2?string = TextWithEntities;
|
||||
|
||||
messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates;
|
||||
|
||||
@@ -3976,6 +4004,20 @@ messages.declineUrlAuth#35436bbc url:string = Bool;
|
||||
|
||||
messages.checkUrlAuthMatchCode#c9a47b0b url:string match_code:string = Bool;
|
||||
|
||||
messages.composeMessageWithAI#fd426afe flags:# proofread:flags.0?true emojify:flags.3?true text:TextWithEntities translate_to_lang:flags.1?string change_tone:flags.2?string = messages.ComposedMessageWithAI;
|
||||
|
||||
messages.reportReadMetrics#4067c5e6 peer:InputPeer metrics:Vector<InputMessageReadMetric> = Bool;
|
||||
|
||||
messages.reportMusicListen#ddbcd819 id:InputDocument listened_duration:int = Bool;
|
||||
|
||||
messages.addPollAnswer#19bc4b6d peer:InputPeer msg_id:int answer:PollAnswer = Updates;
|
||||
|
||||
messages.deletePollAnswer#ac8505a5 peer:InputPeer msg_id:int option:bytes = Updates;
|
||||
|
||||
messages.getUnreadPollVotes#43286cf2 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
|
||||
messages.readPollVotes#1720b4d8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
|
||||
updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference;
|
||||
@@ -4234,6 +4276,16 @@ bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?Inp
|
||||
|
||||
bots.getBotRecommendations#a1b70815 bot:InputUser = users.Users;
|
||||
|
||||
bots.checkUsername#87f2219b username:string = Bool;
|
||||
|
||||
bots.createBot#e5b17f2b flags:# via_deeplink:flags.0?true name:string username:string manager_id:InputUser = User;
|
||||
|
||||
bots.exportBotToken#bd0d99eb bot:InputUser revoke:Bool = bots.ExportedBotToken;
|
||||
|
||||
bots.requestWebViewButton#31a2a35e user_id:InputUser button:KeyboardButton = bots.RequestedButton;
|
||||
|
||||
bots.getRequestedWebViewButton#bf25b7f3 bot:InputUser webapp_req_id:string = KeyboardButton;
|
||||
|
||||
payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;
|
||||
|
||||
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
|
||||
@@ -4330,7 +4382,7 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<Inpu
|
||||
|
||||
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
|
||||
|
||||
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
||||
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true stars_only:flags.5?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
||||
|
||||
payments.updateStarGiftPrice#edbe6ccb stargift:InputSavedStarGift resell_amount:StarsAmount = Updates;
|
||||
|
||||
@@ -4522,9 +4574,9 @@ chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer>
|
||||
|
||||
stories.canSendStory#30eb63f0 peer:InputPeer = stories.CanSendStoryCount;
|
||||
|
||||
stories.sendStory#737fc2ec flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int albums:flags.8?Vector<int> = Updates;
|
||||
stories.sendStory#8f9e6898 flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int albums:flags.8?Vector<int> music:flags.9?InputDocument = Updates;
|
||||
|
||||
stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates;
|
||||
stories.editStory#2c63a72b flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> music:flags.4?InputDocument = Updates;
|
||||
|
||||
stories.deleteStories#ae59db5f peer:InputPeer id:Vector<int> = Vector<int>;
|
||||
|
||||
@@ -4644,4 +4696,4 @@ test.useError#ee75af01 = Error;
|
||||
|
||||
test.useConfigSimple#f9b7b23d = help.ConfigSimple;
|
||||
|
||||
// LAYER 223
|
||||
// LAYER 224
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestConn_handleSessionCreated(t *testing.T) {
|
||||
|
||||
msgs := logs.All()
|
||||
a.Len(msgs, 1)
|
||||
a.Equal("Local clock needs synchronization", msgs[0].Message)
|
||||
a.Equal("Updated server time offset (high)", msgs[0].Message)
|
||||
})
|
||||
t.Run("Invalid", func(t *testing.T) {
|
||||
conn := Conn{}
|
||||
|
||||
+58
@@ -422,3 +422,61 @@ func FormattedDate(relative bool, shortTime bool, longTime bool, shortDate bool,
|
||||
func (b *Builder) FormattedDate(s string, relative bool, shortTime bool, longTime bool, shortDate bool, longDate bool, dayOfWeek bool, date int) *Builder {
|
||||
return b.Format(s, FormattedDate(relative, shortTime, longTime, shortDate, longDate, dayOfWeek, date))
|
||||
}
|
||||
|
||||
// DiffInsert creates Formatter of DiffInsert message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffInsert.
|
||||
func DiffInsert() Formatter {
|
||||
return func(offset, length int) tg.MessageEntityClass {
|
||||
return &tg.MessageEntityDiffInsert{
|
||||
Offset: offset,
|
||||
Length: length,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DiffInsert adds and formats message as DiffInsert message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffInsert.
|
||||
func (b *Builder) DiffInsert(s string) *Builder {
|
||||
return b.Format(s, DiffInsert())
|
||||
}
|
||||
|
||||
// DiffReplace creates Formatter of DiffReplace message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffReplace.
|
||||
func DiffReplace(oldText string) Formatter {
|
||||
return func(offset, length int) tg.MessageEntityClass {
|
||||
return &tg.MessageEntityDiffReplace{
|
||||
Offset: offset,
|
||||
Length: length,
|
||||
OldText: oldText,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DiffReplace adds and formats message as DiffReplace message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffReplace.
|
||||
func (b *Builder) DiffReplace(s string, oldText string) *Builder {
|
||||
return b.Format(s, DiffReplace(oldText))
|
||||
}
|
||||
|
||||
// DiffDelete creates Formatter of DiffDelete message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffDelete.
|
||||
func DiffDelete() Formatter {
|
||||
return func(offset, length int) tg.MessageEntityClass {
|
||||
return &tg.MessageEntityDiffDelete{
|
||||
Offset: offset,
|
||||
Length: length,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DiffDelete adds and formats message as DiffDelete message entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffDelete.
|
||||
func (b *Builder) DiffDelete(s string) *Builder {
|
||||
return b.Format(s, DiffDelete())
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ type pollAnswerBuilder struct {
|
||||
type PollAnswerOption func(p *pollAnswerBuilder)
|
||||
|
||||
// RawPollAnswer creates new raw poll answer option.
|
||||
func RawPollAnswer(poll tg.PollAnswer) PollAnswerOption {
|
||||
func RawPollAnswer(poll *tg.PollAnswer) PollAnswerOption {
|
||||
return func(p *pollAnswerBuilder) {
|
||||
p.input.Poll.Answers = append(p.input.Poll.Answers, poll)
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func RawPollAnswer(poll tg.PollAnswer) PollAnswerOption {
|
||||
func PollAnswer(text string, entities ...tg.MessageEntityClass) PollAnswerOption {
|
||||
return func(p *pollAnswerBuilder) {
|
||||
i := len(p.input.Poll.Answers)
|
||||
p.input.Poll.Answers = append(p.input.Poll.Answers, tg.PollAnswer{
|
||||
p.input.Poll.Answers = append(p.input.Poll.Answers, &tg.PollAnswer{
|
||||
Text: tg.TextWithEntities{Text: text, Entities: entities},
|
||||
Option: []byte(strconv.Itoa(i)),
|
||||
})
|
||||
@@ -44,11 +44,11 @@ func CorrectPollAnswer(text string, entities ...tg.MessageEntityClass) PollAnswe
|
||||
p.input.Poll.Quiz = true
|
||||
i := len(p.input.Poll.Answers)
|
||||
option := []byte(strconv.Itoa(i))
|
||||
p.input.Poll.Answers = append(p.input.Poll.Answers, tg.PollAnswer{
|
||||
p.input.Poll.Answers = append(p.input.Poll.Answers, &tg.PollAnswer{
|
||||
Text: tg.TextWithEntities{Text: text, Entities: entities},
|
||||
Option: option,
|
||||
})
|
||||
p.input.CorrectAnswers = append(p.input.CorrectAnswers, option)
|
||||
p.input.CorrectAnswers = append(p.input.CorrectAnswers, i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestPoll(t *testing.T) {
|
||||
id = m.Poll.ID
|
||||
require.Len(t, m.Poll.Answers, 3)
|
||||
require.Len(t, m.CorrectAnswers, 1)
|
||||
require.Equal(t, m.Poll.Answers[0].Option, m.CorrectAnswers[0])
|
||||
require.Equal(t, 0, m.CorrectAnswers[0])
|
||||
}).ThenResult(&tg.Updates{})
|
||||
mock.ExpectFunc(func(b bin.Encoder) {
|
||||
req, ok := b.(*tg.MessagesSendMediaRequest)
|
||||
|
||||
+30
@@ -221,3 +221,33 @@ func FormattedDate(s string, relative bool, shortTime bool, longTime bool, short
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// DiffInsert formats text as DiffInsert entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffInsert.
|
||||
func DiffInsert(s string) StyledTextOption {
|
||||
return styledTextOption(s, func(b *textBuilder) error {
|
||||
b.DiffInsert(s)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// DiffReplace formats text as DiffReplace entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffReplace.
|
||||
func DiffReplace(s string, oldText string) StyledTextOption {
|
||||
return styledTextOption(s, func(b *textBuilder) error {
|
||||
b.DiffReplace(s, oldText)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// DiffDelete formats text as DiffDelete entity.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffDelete.
|
||||
func DiffDelete(s string) StyledTextOption {
|
||||
return styledTextOption(s, func(b *textBuilder) error {
|
||||
b.DiffDelete(s)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
+124
@@ -692,6 +692,112 @@ func (b *GetUnreadMentionsQueryBuilder) Collect(ctx context.Context) ([]Elem, er
|
||||
return r, iter.Err()
|
||||
}
|
||||
|
||||
// GetUnreadPollVotesQueryBuilder is query builder of MessagesGetUnreadPollVotes.
|
||||
type GetUnreadPollVotesQueryBuilder struct {
|
||||
raw *tg.Client
|
||||
req tg.MessagesGetUnreadPollVotesRequest
|
||||
batchSize int
|
||||
addOffset int
|
||||
offsetID int
|
||||
}
|
||||
|
||||
// GetUnreadPollVotes creates query builder of MessagesGetUnreadPollVotes.
|
||||
func (q *QueryBuilder) GetUnreadPollVotes(paramPeer tg.InputPeerClass) *GetUnreadPollVotesQueryBuilder {
|
||||
b := &GetUnreadPollVotesQueryBuilder{
|
||||
raw: q.raw,
|
||||
batchSize: 1,
|
||||
req: tg.MessagesGetUnreadPollVotesRequest{
|
||||
Peer: &tg.InputPeerEmpty{},
|
||||
},
|
||||
}
|
||||
|
||||
b.req.Peer = paramPeer
|
||||
return b
|
||||
}
|
||||
|
||||
// BatchSize sets buffer of message loaded from one request.
|
||||
// Be carefully, when set this limit, because Telegram does not return error if limit is too big,
|
||||
// so results can be incorrect.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) BatchSize(batchSize int) *GetUnreadPollVotesQueryBuilder {
|
||||
b.batchSize = batchSize
|
||||
return b
|
||||
}
|
||||
|
||||
// OffsetID sets offsetID from which iterate start.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) OffsetID(offsetID int) *GetUnreadPollVotesQueryBuilder {
|
||||
b.offsetID = offsetID
|
||||
return b
|
||||
}
|
||||
|
||||
// Peer sets Peer field of GetUnreadPollVotes query.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) Peer(paramPeer tg.InputPeerClass) *GetUnreadPollVotesQueryBuilder {
|
||||
b.req.Peer = paramPeer
|
||||
return b
|
||||
}
|
||||
|
||||
// TopMsgID sets TopMsgID field of GetUnreadPollVotes query.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) TopMsgID(paramTopMsgID int) *GetUnreadPollVotesQueryBuilder {
|
||||
b.req.TopMsgID = paramTopMsgID
|
||||
return b
|
||||
}
|
||||
|
||||
// Query implements Query interface.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesMessagesClass, error) {
|
||||
r := &tg.MessagesGetUnreadPollVotesRequest{
|
||||
Limit: req.Limit,
|
||||
}
|
||||
|
||||
r.Peer = b.req.Peer
|
||||
r.TopMsgID = b.req.TopMsgID
|
||||
r.AddOffset = req.AddOffset
|
||||
r.OffsetID = req.OffsetID
|
||||
return b.raw.MessagesGetUnreadPollVotes(ctx, r)
|
||||
}
|
||||
|
||||
// Iter returns iterator using built query.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) Iter() *Iterator {
|
||||
iter := NewIterator(b, b.batchSize)
|
||||
iter = iter.OffsetID(b.offsetID)
|
||||
return iter
|
||||
}
|
||||
|
||||
// ForEach calls given callback on each iterator element.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error {
|
||||
iter := b.Iter()
|
||||
for iter.Next(ctx) {
|
||||
if err := cb(ctx, iter.Value()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return iter.Err()
|
||||
}
|
||||
|
||||
// Count fetches remote state to get number of elements.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) Count(ctx context.Context) (int, error) {
|
||||
iter := b.Iter()
|
||||
c, err := iter.Total(ctx)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "get total")
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Collect creates iterator and collects all elements to slice.
|
||||
func (b *GetUnreadPollVotesQueryBuilder) Collect(ctx context.Context) ([]Elem, error) {
|
||||
iter := b.Iter()
|
||||
c, err := iter.Total(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get total")
|
||||
}
|
||||
|
||||
r := make([]Elem, 0, c)
|
||||
for iter.Next(ctx) {
|
||||
r = append(r, iter.Value())
|
||||
}
|
||||
|
||||
return r, iter.Err()
|
||||
}
|
||||
|
||||
// GetUnreadReactionsQueryBuilder is query builder of MessagesGetUnreadReactions.
|
||||
type GetUnreadReactionsQueryBuilder struct {
|
||||
raw *tg.Client
|
||||
@@ -968,6 +1074,12 @@ func (b *SearchQueryBuilder) Pinned() *SearchQueryBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Poll sets Filter field of Search query.
|
||||
func (b *SearchQueryBuilder) Poll() *SearchQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterPoll{}
|
||||
return b
|
||||
}
|
||||
|
||||
// RoundVideo sets Filter field of Search query.
|
||||
func (b *SearchQueryBuilder) RoundVideo() *SearchQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterRoundVideo{}
|
||||
@@ -1215,6 +1327,12 @@ func (b *SearchGlobalQueryBuilder) Pinned() *SearchGlobalQueryBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Poll sets Filter field of SearchGlobal query.
|
||||
func (b *SearchGlobalQueryBuilder) Poll() *SearchGlobalQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterPoll{}
|
||||
return b
|
||||
}
|
||||
|
||||
// RoundVideo sets Filter field of SearchGlobal query.
|
||||
func (b *SearchGlobalQueryBuilder) RoundVideo() *SearchGlobalQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterRoundVideo{}
|
||||
@@ -1417,6 +1535,12 @@ func (b *SearchSentMediaQueryBuilder) Pinned() *SearchSentMediaQueryBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Poll sets Filter field of SearchSentMedia query.
|
||||
func (b *SearchSentMediaQueryBuilder) Poll() *SearchSentMediaQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterPoll{}
|
||||
return b
|
||||
}
|
||||
|
||||
// RoundVideo sets Filter field of SearchSentMedia query.
|
||||
func (b *SearchSentMediaQueryBuilder) RoundVideo() *SearchSentMediaQueryBuilder {
|
||||
b.req.Filter = &tg.InputMessagesFilterRoundVideo{}
|
||||
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsCheckUsernameRequest represents TL type `bots.checkUsername#87f2219b`.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.checkUsername for reference.
|
||||
type BotsCheckUsernameRequest struct {
|
||||
// Username field of BotsCheckUsernameRequest.
|
||||
Username string
|
||||
}
|
||||
|
||||
// BotsCheckUsernameRequestTypeID is TL type id of BotsCheckUsernameRequest.
|
||||
const BotsCheckUsernameRequestTypeID = 0x87f2219b
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsCheckUsernameRequest.
|
||||
var (
|
||||
_ bin.Encoder = &BotsCheckUsernameRequest{}
|
||||
_ bin.Decoder = &BotsCheckUsernameRequest{}
|
||||
_ bin.BareEncoder = &BotsCheckUsernameRequest{}
|
||||
_ bin.BareDecoder = &BotsCheckUsernameRequest{}
|
||||
)
|
||||
|
||||
func (c *BotsCheckUsernameRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Username == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *BotsCheckUsernameRequest) String() string {
|
||||
if c == nil {
|
||||
return "BotsCheckUsernameRequest(nil)"
|
||||
}
|
||||
type Alias BotsCheckUsernameRequest
|
||||
return fmt.Sprintf("BotsCheckUsernameRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsCheckUsernameRequest from given interface.
|
||||
func (c *BotsCheckUsernameRequest) FillFrom(from interface {
|
||||
GetUsername() (value string)
|
||||
}) {
|
||||
c.Username = from.GetUsername()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsCheckUsernameRequest) TypeID() uint32 {
|
||||
return BotsCheckUsernameRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsCheckUsernameRequest) TypeName() string {
|
||||
return "bots.checkUsername"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *BotsCheckUsernameRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.checkUsername",
|
||||
ID: BotsCheckUsernameRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Username",
|
||||
SchemaName: "username",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *BotsCheckUsernameRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode bots.checkUsername#87f2219b as nil")
|
||||
}
|
||||
b.PutID(BotsCheckUsernameRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *BotsCheckUsernameRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode bots.checkUsername#87f2219b as nil")
|
||||
}
|
||||
b.PutString(c.Username)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *BotsCheckUsernameRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode bots.checkUsername#87f2219b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsCheckUsernameRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.checkUsername#87f2219b: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *BotsCheckUsernameRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode bots.checkUsername#87f2219b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.checkUsername#87f2219b: field username: %w", err)
|
||||
}
|
||||
c.Username = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUsername returns value of Username field.
|
||||
func (c *BotsCheckUsernameRequest) GetUsername() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Username
|
||||
}
|
||||
|
||||
// BotsCheckUsername invokes method bots.checkUsername#87f2219b returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.checkUsername for reference.
|
||||
func (c *Client) BotsCheckUsername(ctx context.Context, username string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &BotsCheckUsernameRequest{
|
||||
Username: username,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
Generated
+285
@@ -0,0 +1,285 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsCreateBotRequest represents TL type `bots.createBot#e5b17f2b`.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.createBot for reference.
|
||||
type BotsCreateBotRequest struct {
|
||||
// Flags field of BotsCreateBotRequest.
|
||||
Flags bin.Fields
|
||||
// ViaDeeplink field of BotsCreateBotRequest.
|
||||
ViaDeeplink bool
|
||||
// Name field of BotsCreateBotRequest.
|
||||
Name string
|
||||
// Username field of BotsCreateBotRequest.
|
||||
Username string
|
||||
// ManagerID field of BotsCreateBotRequest.
|
||||
ManagerID InputUserClass
|
||||
}
|
||||
|
||||
// BotsCreateBotRequestTypeID is TL type id of BotsCreateBotRequest.
|
||||
const BotsCreateBotRequestTypeID = 0xe5b17f2b
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsCreateBotRequest.
|
||||
var (
|
||||
_ bin.Encoder = &BotsCreateBotRequest{}
|
||||
_ bin.Decoder = &BotsCreateBotRequest{}
|
||||
_ bin.BareEncoder = &BotsCreateBotRequest{}
|
||||
_ bin.BareDecoder = &BotsCreateBotRequest{}
|
||||
)
|
||||
|
||||
func (c *BotsCreateBotRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.ViaDeeplink == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.Name == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.Username == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.ManagerID == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *BotsCreateBotRequest) String() string {
|
||||
if c == nil {
|
||||
return "BotsCreateBotRequest(nil)"
|
||||
}
|
||||
type Alias BotsCreateBotRequest
|
||||
return fmt.Sprintf("BotsCreateBotRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsCreateBotRequest from given interface.
|
||||
func (c *BotsCreateBotRequest) FillFrom(from interface {
|
||||
GetViaDeeplink() (value bool)
|
||||
GetName() (value string)
|
||||
GetUsername() (value string)
|
||||
GetManagerID() (value InputUserClass)
|
||||
}) {
|
||||
c.ViaDeeplink = from.GetViaDeeplink()
|
||||
c.Name = from.GetName()
|
||||
c.Username = from.GetUsername()
|
||||
c.ManagerID = from.GetManagerID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsCreateBotRequest) TypeID() uint32 {
|
||||
return BotsCreateBotRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsCreateBotRequest) TypeName() string {
|
||||
return "bots.createBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *BotsCreateBotRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.createBot",
|
||||
ID: BotsCreateBotRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ViaDeeplink",
|
||||
SchemaName: "via_deeplink",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Name",
|
||||
SchemaName: "name",
|
||||
},
|
||||
{
|
||||
Name: "Username",
|
||||
SchemaName: "username",
|
||||
},
|
||||
{
|
||||
Name: "ManagerID",
|
||||
SchemaName: "manager_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *BotsCreateBotRequest) SetFlags() {
|
||||
if !(c.ViaDeeplink == false) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *BotsCreateBotRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode bots.createBot#e5b17f2b as nil")
|
||||
}
|
||||
b.PutID(BotsCreateBotRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *BotsCreateBotRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode bots.createBot#e5b17f2b as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.createBot#e5b17f2b: field flags: %w", err)
|
||||
}
|
||||
b.PutString(c.Name)
|
||||
b.PutString(c.Username)
|
||||
if c.ManagerID == nil {
|
||||
return fmt.Errorf("unable to encode bots.createBot#e5b17f2b: field manager_id is nil")
|
||||
}
|
||||
if err := c.ManagerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.createBot#e5b17f2b: field manager_id: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *BotsCreateBotRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode bots.createBot#e5b17f2b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsCreateBotRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.createBot#e5b17f2b: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *BotsCreateBotRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode bots.createBot#e5b17f2b to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.createBot#e5b17f2b: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.ViaDeeplink = c.Flags.Has(0)
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.createBot#e5b17f2b: field name: %w", err)
|
||||
}
|
||||
c.Name = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.createBot#e5b17f2b: field username: %w", err)
|
||||
}
|
||||
c.Username = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.createBot#e5b17f2b: field manager_id: %w", err)
|
||||
}
|
||||
c.ManagerID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetViaDeeplink sets value of ViaDeeplink conditional field.
|
||||
func (c *BotsCreateBotRequest) SetViaDeeplink(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(0)
|
||||
c.ViaDeeplink = true
|
||||
} else {
|
||||
c.Flags.Unset(0)
|
||||
c.ViaDeeplink = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetViaDeeplink returns value of ViaDeeplink conditional field.
|
||||
func (c *BotsCreateBotRequest) GetViaDeeplink() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(0)
|
||||
}
|
||||
|
||||
// GetName returns value of Name field.
|
||||
func (c *BotsCreateBotRequest) GetName() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Name
|
||||
}
|
||||
|
||||
// GetUsername returns value of Username field.
|
||||
func (c *BotsCreateBotRequest) GetUsername() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Username
|
||||
}
|
||||
|
||||
// GetManagerID returns value of ManagerID field.
|
||||
func (c *BotsCreateBotRequest) GetManagerID() (value InputUserClass) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.ManagerID
|
||||
}
|
||||
|
||||
// BotsCreateBot invokes method bots.createBot#e5b17f2b returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.createBot for reference.
|
||||
func (c *Client) BotsCreateBot(ctx context.Context, request *BotsCreateBotRequest) (UserClass, error) {
|
||||
var result UserBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.User, nil
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsExportBotTokenRequest represents TL type `bots.exportBotToken#bd0d99eb`.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.exportBotToken for reference.
|
||||
type BotsExportBotTokenRequest struct {
|
||||
// Bot field of BotsExportBotTokenRequest.
|
||||
Bot InputUserClass
|
||||
// Revoke field of BotsExportBotTokenRequest.
|
||||
Revoke bool
|
||||
}
|
||||
|
||||
// BotsExportBotTokenRequestTypeID is TL type id of BotsExportBotTokenRequest.
|
||||
const BotsExportBotTokenRequestTypeID = 0xbd0d99eb
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsExportBotTokenRequest.
|
||||
var (
|
||||
_ bin.Encoder = &BotsExportBotTokenRequest{}
|
||||
_ bin.Decoder = &BotsExportBotTokenRequest{}
|
||||
_ bin.BareEncoder = &BotsExportBotTokenRequest{}
|
||||
_ bin.BareDecoder = &BotsExportBotTokenRequest{}
|
||||
)
|
||||
|
||||
func (e *BotsExportBotTokenRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Bot == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Revoke == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *BotsExportBotTokenRequest) String() string {
|
||||
if e == nil {
|
||||
return "BotsExportBotTokenRequest(nil)"
|
||||
}
|
||||
type Alias BotsExportBotTokenRequest
|
||||
return fmt.Sprintf("BotsExportBotTokenRequest%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsExportBotTokenRequest from given interface.
|
||||
func (e *BotsExportBotTokenRequest) FillFrom(from interface {
|
||||
GetBot() (value InputUserClass)
|
||||
GetRevoke() (value bool)
|
||||
}) {
|
||||
e.Bot = from.GetBot()
|
||||
e.Revoke = from.GetRevoke()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsExportBotTokenRequest) TypeID() uint32 {
|
||||
return BotsExportBotTokenRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsExportBotTokenRequest) TypeName() string {
|
||||
return "bots.exportBotToken"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *BotsExportBotTokenRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.exportBotToken",
|
||||
ID: BotsExportBotTokenRequestTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Bot",
|
||||
SchemaName: "bot",
|
||||
},
|
||||
{
|
||||
Name: "Revoke",
|
||||
SchemaName: "revoke",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *BotsExportBotTokenRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode bots.exportBotToken#bd0d99eb as nil")
|
||||
}
|
||||
b.PutID(BotsExportBotTokenRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *BotsExportBotTokenRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode bots.exportBotToken#bd0d99eb as nil")
|
||||
}
|
||||
if e.Bot == nil {
|
||||
return fmt.Errorf("unable to encode bots.exportBotToken#bd0d99eb: field bot is nil")
|
||||
}
|
||||
if err := e.Bot.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.exportBotToken#bd0d99eb: field bot: %w", err)
|
||||
}
|
||||
b.PutBool(e.Revoke)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *BotsExportBotTokenRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode bots.exportBotToken#bd0d99eb to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsExportBotTokenRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.exportBotToken#bd0d99eb: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *BotsExportBotTokenRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode bots.exportBotToken#bd0d99eb to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.exportBotToken#bd0d99eb: field bot: %w", err)
|
||||
}
|
||||
e.Bot = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.exportBotToken#bd0d99eb: field revoke: %w", err)
|
||||
}
|
||||
e.Revoke = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBot returns value of Bot field.
|
||||
func (e *BotsExportBotTokenRequest) GetBot() (value InputUserClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Bot
|
||||
}
|
||||
|
||||
// GetRevoke returns value of Revoke field.
|
||||
func (e *BotsExportBotTokenRequest) GetRevoke() (value bool) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Revoke
|
||||
}
|
||||
|
||||
// BotsExportBotToken invokes method bots.exportBotToken#bd0d99eb returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.exportBotToken for reference.
|
||||
func (c *Client) BotsExportBotToken(ctx context.Context, request *BotsExportBotTokenRequest) (*BotsExportedBotToken, error) {
|
||||
var result BotsExportedBotToken
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsExportedBotToken represents TL type `bots.exportedBotToken#3c60b621`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/bots.exportedBotToken for reference.
|
||||
type BotsExportedBotToken struct {
|
||||
// Token field of BotsExportedBotToken.
|
||||
Token string
|
||||
}
|
||||
|
||||
// BotsExportedBotTokenTypeID is TL type id of BotsExportedBotToken.
|
||||
const BotsExportedBotTokenTypeID = 0x3c60b621
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsExportedBotToken.
|
||||
var (
|
||||
_ bin.Encoder = &BotsExportedBotToken{}
|
||||
_ bin.Decoder = &BotsExportedBotToken{}
|
||||
_ bin.BareEncoder = &BotsExportedBotToken{}
|
||||
_ bin.BareDecoder = &BotsExportedBotToken{}
|
||||
)
|
||||
|
||||
func (e *BotsExportedBotToken) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Token == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *BotsExportedBotToken) String() string {
|
||||
if e == nil {
|
||||
return "BotsExportedBotToken(nil)"
|
||||
}
|
||||
type Alias BotsExportedBotToken
|
||||
return fmt.Sprintf("BotsExportedBotToken%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsExportedBotToken from given interface.
|
||||
func (e *BotsExportedBotToken) FillFrom(from interface {
|
||||
GetToken() (value string)
|
||||
}) {
|
||||
e.Token = from.GetToken()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsExportedBotToken) TypeID() uint32 {
|
||||
return BotsExportedBotTokenTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsExportedBotToken) TypeName() string {
|
||||
return "bots.exportedBotToken"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *BotsExportedBotToken) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.exportedBotToken",
|
||||
ID: BotsExportedBotTokenTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Token",
|
||||
SchemaName: "token",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *BotsExportedBotToken) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode bots.exportedBotToken#3c60b621 as nil")
|
||||
}
|
||||
b.PutID(BotsExportedBotTokenTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *BotsExportedBotToken) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode bots.exportedBotToken#3c60b621 as nil")
|
||||
}
|
||||
b.PutString(e.Token)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *BotsExportedBotToken) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode bots.exportedBotToken#3c60b621 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsExportedBotTokenTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.exportedBotToken#3c60b621: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *BotsExportedBotToken) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode bots.exportedBotToken#3c60b621 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.exportedBotToken#3c60b621: field token: %w", err)
|
||||
}
|
||||
e.Token = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetToken returns value of Token field.
|
||||
func (e *BotsExportedBotToken) GetToken() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Token
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,205 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsGetRequestedWebViewButtonRequest represents TL type `bots.getRequestedWebViewButton#bf25b7f3`.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.getRequestedWebViewButton for reference.
|
||||
type BotsGetRequestedWebViewButtonRequest struct {
|
||||
// Bot field of BotsGetRequestedWebViewButtonRequest.
|
||||
Bot InputUserClass
|
||||
// WebappReqID field of BotsGetRequestedWebViewButtonRequest.
|
||||
WebappReqID string
|
||||
}
|
||||
|
||||
// BotsGetRequestedWebViewButtonRequestTypeID is TL type id of BotsGetRequestedWebViewButtonRequest.
|
||||
const BotsGetRequestedWebViewButtonRequestTypeID = 0xbf25b7f3
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsGetRequestedWebViewButtonRequest.
|
||||
var (
|
||||
_ bin.Encoder = &BotsGetRequestedWebViewButtonRequest{}
|
||||
_ bin.Decoder = &BotsGetRequestedWebViewButtonRequest{}
|
||||
_ bin.BareEncoder = &BotsGetRequestedWebViewButtonRequest{}
|
||||
_ bin.BareDecoder = &BotsGetRequestedWebViewButtonRequest{}
|
||||
)
|
||||
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Bot == nil) {
|
||||
return false
|
||||
}
|
||||
if !(g.WebappReqID == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) String() string {
|
||||
if g == nil {
|
||||
return "BotsGetRequestedWebViewButtonRequest(nil)"
|
||||
}
|
||||
type Alias BotsGetRequestedWebViewButtonRequest
|
||||
return fmt.Sprintf("BotsGetRequestedWebViewButtonRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsGetRequestedWebViewButtonRequest from given interface.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) FillFrom(from interface {
|
||||
GetBot() (value InputUserClass)
|
||||
GetWebappReqID() (value string)
|
||||
}) {
|
||||
g.Bot = from.GetBot()
|
||||
g.WebappReqID = from.GetWebappReqID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsGetRequestedWebViewButtonRequest) TypeID() uint32 {
|
||||
return BotsGetRequestedWebViewButtonRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsGetRequestedWebViewButtonRequest) TypeName() string {
|
||||
return "bots.getRequestedWebViewButton"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.getRequestedWebViewButton",
|
||||
ID: BotsGetRequestedWebViewButtonRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Bot",
|
||||
SchemaName: "bot",
|
||||
},
|
||||
{
|
||||
Name: "WebappReqID",
|
||||
SchemaName: "webapp_req_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode bots.getRequestedWebViewButton#bf25b7f3 as nil")
|
||||
}
|
||||
b.PutID(BotsGetRequestedWebViewButtonRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode bots.getRequestedWebViewButton#bf25b7f3 as nil")
|
||||
}
|
||||
if g.Bot == nil {
|
||||
return fmt.Errorf("unable to encode bots.getRequestedWebViewButton#bf25b7f3: field bot is nil")
|
||||
}
|
||||
if err := g.Bot.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.getRequestedWebViewButton#bf25b7f3: field bot: %w", err)
|
||||
}
|
||||
b.PutString(g.WebappReqID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode bots.getRequestedWebViewButton#bf25b7f3 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsGetRequestedWebViewButtonRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.getRequestedWebViewButton#bf25b7f3: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode bots.getRequestedWebViewButton#bf25b7f3 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.getRequestedWebViewButton#bf25b7f3: field bot: %w", err)
|
||||
}
|
||||
g.Bot = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.getRequestedWebViewButton#bf25b7f3: field webapp_req_id: %w", err)
|
||||
}
|
||||
g.WebappReqID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBot returns value of Bot field.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) GetBot() (value InputUserClass) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Bot
|
||||
}
|
||||
|
||||
// GetWebappReqID returns value of WebappReqID field.
|
||||
func (g *BotsGetRequestedWebViewButtonRequest) GetWebappReqID() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.WebappReqID
|
||||
}
|
||||
|
||||
// BotsGetRequestedWebViewButton invokes method bots.getRequestedWebViewButton#bf25b7f3 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.getRequestedWebViewButton for reference.
|
||||
func (c *Client) BotsGetRequestedWebViewButton(ctx context.Context, request *BotsGetRequestedWebViewButtonRequest) (KeyboardButtonClass, error) {
|
||||
var result KeyboardButtonBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.KeyboardButton, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsRequestWebViewButtonRequest represents TL type `bots.requestWebViewButton#31a2a35e`.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.requestWebViewButton for reference.
|
||||
type BotsRequestWebViewButtonRequest struct {
|
||||
// UserID field of BotsRequestWebViewButtonRequest.
|
||||
UserID InputUserClass
|
||||
// Button field of BotsRequestWebViewButtonRequest.
|
||||
Button KeyboardButtonClass
|
||||
}
|
||||
|
||||
// BotsRequestWebViewButtonRequestTypeID is TL type id of BotsRequestWebViewButtonRequest.
|
||||
const BotsRequestWebViewButtonRequestTypeID = 0x31a2a35e
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsRequestWebViewButtonRequest.
|
||||
var (
|
||||
_ bin.Encoder = &BotsRequestWebViewButtonRequest{}
|
||||
_ bin.Decoder = &BotsRequestWebViewButtonRequest{}
|
||||
_ bin.BareEncoder = &BotsRequestWebViewButtonRequest{}
|
||||
_ bin.BareDecoder = &BotsRequestWebViewButtonRequest{}
|
||||
)
|
||||
|
||||
func (r *BotsRequestWebViewButtonRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.UserID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.Button == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *BotsRequestWebViewButtonRequest) String() string {
|
||||
if r == nil {
|
||||
return "BotsRequestWebViewButtonRequest(nil)"
|
||||
}
|
||||
type Alias BotsRequestWebViewButtonRequest
|
||||
return fmt.Sprintf("BotsRequestWebViewButtonRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsRequestWebViewButtonRequest from given interface.
|
||||
func (r *BotsRequestWebViewButtonRequest) FillFrom(from interface {
|
||||
GetUserID() (value InputUserClass)
|
||||
GetButton() (value KeyboardButtonClass)
|
||||
}) {
|
||||
r.UserID = from.GetUserID()
|
||||
r.Button = from.GetButton()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsRequestWebViewButtonRequest) TypeID() uint32 {
|
||||
return BotsRequestWebViewButtonRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsRequestWebViewButtonRequest) TypeName() string {
|
||||
return "bots.requestWebViewButton"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *BotsRequestWebViewButtonRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.requestWebViewButton",
|
||||
ID: BotsRequestWebViewButtonRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "Button",
|
||||
SchemaName: "button",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *BotsRequestWebViewButtonRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode bots.requestWebViewButton#31a2a35e as nil")
|
||||
}
|
||||
b.PutID(BotsRequestWebViewButtonRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *BotsRequestWebViewButtonRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode bots.requestWebViewButton#31a2a35e as nil")
|
||||
}
|
||||
if r.UserID == nil {
|
||||
return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field user_id is nil")
|
||||
}
|
||||
if err := r.UserID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field user_id: %w", err)
|
||||
}
|
||||
if r.Button == nil {
|
||||
return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field button is nil")
|
||||
}
|
||||
if err := r.Button.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field button: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *BotsRequestWebViewButtonRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode bots.requestWebViewButton#31a2a35e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsRequestWebViewButtonRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.requestWebViewButton#31a2a35e: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *BotsRequestWebViewButtonRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode bots.requestWebViewButton#31a2a35e to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.requestWebViewButton#31a2a35e: field user_id: %w", err)
|
||||
}
|
||||
r.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeKeyboardButton(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.requestWebViewButton#31a2a35e: field button: %w", err)
|
||||
}
|
||||
r.Button = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (r *BotsRequestWebViewButtonRequest) GetUserID() (value InputUserClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.UserID
|
||||
}
|
||||
|
||||
// GetButton returns value of Button field.
|
||||
func (r *BotsRequestWebViewButtonRequest) GetButton() (value KeyboardButtonClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Button
|
||||
}
|
||||
|
||||
// BotsRequestWebViewButton invokes method bots.requestWebViewButton#31a2a35e returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/bots.requestWebViewButton for reference.
|
||||
func (c *Client) BotsRequestWebViewButton(ctx context.Context, request *BotsRequestWebViewButtonRequest) (*BotsRequestedButton, error) {
|
||||
var result BotsRequestedButton
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BotsRequestedButton represents TL type `bots.requestedButton#f13bbcd7`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/bots.requestedButton for reference.
|
||||
type BotsRequestedButton struct {
|
||||
// WebappReqID field of BotsRequestedButton.
|
||||
WebappReqID string
|
||||
}
|
||||
|
||||
// BotsRequestedButtonTypeID is TL type id of BotsRequestedButton.
|
||||
const BotsRequestedButtonTypeID = 0xf13bbcd7
|
||||
|
||||
// Ensuring interfaces in compile-time for BotsRequestedButton.
|
||||
var (
|
||||
_ bin.Encoder = &BotsRequestedButton{}
|
||||
_ bin.Decoder = &BotsRequestedButton{}
|
||||
_ bin.BareEncoder = &BotsRequestedButton{}
|
||||
_ bin.BareDecoder = &BotsRequestedButton{}
|
||||
)
|
||||
|
||||
func (r *BotsRequestedButton) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.WebappReqID == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *BotsRequestedButton) String() string {
|
||||
if r == nil {
|
||||
return "BotsRequestedButton(nil)"
|
||||
}
|
||||
type Alias BotsRequestedButton
|
||||
return fmt.Sprintf("BotsRequestedButton%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills BotsRequestedButton from given interface.
|
||||
func (r *BotsRequestedButton) FillFrom(from interface {
|
||||
GetWebappReqID() (value string)
|
||||
}) {
|
||||
r.WebappReqID = from.GetWebappReqID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BotsRequestedButton) TypeID() uint32 {
|
||||
return BotsRequestedButtonTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BotsRequestedButton) TypeName() string {
|
||||
return "bots.requestedButton"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *BotsRequestedButton) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bots.requestedButton",
|
||||
ID: BotsRequestedButtonTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "WebappReqID",
|
||||
SchemaName: "webapp_req_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *BotsRequestedButton) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode bots.requestedButton#f13bbcd7 as nil")
|
||||
}
|
||||
b.PutID(BotsRequestedButtonTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *BotsRequestedButton) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode bots.requestedButton#f13bbcd7 as nil")
|
||||
}
|
||||
b.PutString(r.WebappReqID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *BotsRequestedButton) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode bots.requestedButton#f13bbcd7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(BotsRequestedButtonTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bots.requestedButton#f13bbcd7: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *BotsRequestedButton) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode bots.requestedButton#f13bbcd7 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bots.requestedButton#f13bbcd7: field webapp_req_id: %w", err)
|
||||
}
|
||||
r.WebappReqID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetWebappReqID returns value of WebappReqID field.
|
||||
func (r *BotsRequestedButton) GetWebappReqID() (value string) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.WebappReqID
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
Generated
+55
-28
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// Dialog represents TL type `dialog#d58a08c6`.
|
||||
// Dialog represents TL type `dialog#fc89f7f3`.
|
||||
// Chat
|
||||
//
|
||||
// See https://core.telegram.org/constructor/dialog for reference.
|
||||
@@ -72,6 +72,8 @@ type Dialog struct {
|
||||
UnreadMentionsCount int
|
||||
// Number of unread reactions to messages you sent
|
||||
UnreadReactionsCount int
|
||||
// UnreadPollVotesCount field of Dialog.
|
||||
UnreadPollVotesCount int
|
||||
// Notification settings
|
||||
NotifySettings PeerNotifySettings
|
||||
// PTS¹
|
||||
@@ -102,7 +104,7 @@ type Dialog struct {
|
||||
}
|
||||
|
||||
// DialogTypeID is TL type id of Dialog.
|
||||
const DialogTypeID = 0xd58a08c6
|
||||
const DialogTypeID = 0xfc89f7f3
|
||||
|
||||
// construct implements constructor of DialogClass.
|
||||
func (d Dialog) construct() DialogClass { return &d }
|
||||
@@ -154,6 +156,9 @@ func (d *Dialog) Zero() bool {
|
||||
if !(d.UnreadReactionsCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.UnreadPollVotesCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.NotifySettings.Zero()) {
|
||||
return false
|
||||
}
|
||||
@@ -194,6 +199,7 @@ func (d *Dialog) FillFrom(from interface {
|
||||
GetUnreadCount() (value int)
|
||||
GetUnreadMentionsCount() (value int)
|
||||
GetUnreadReactionsCount() (value int)
|
||||
GetUnreadPollVotesCount() (value int)
|
||||
GetNotifySettings() (value PeerNotifySettings)
|
||||
GetPts() (value int, ok bool)
|
||||
GetDraft() (value DraftMessageClass, ok bool)
|
||||
@@ -210,6 +216,7 @@ func (d *Dialog) FillFrom(from interface {
|
||||
d.UnreadCount = from.GetUnreadCount()
|
||||
d.UnreadMentionsCount = from.GetUnreadMentionsCount()
|
||||
d.UnreadReactionsCount = from.GetUnreadReactionsCount()
|
||||
d.UnreadPollVotesCount = from.GetUnreadPollVotesCount()
|
||||
d.NotifySettings = from.GetNotifySettings()
|
||||
if val, ok := from.GetPts(); ok {
|
||||
d.Pts = val
|
||||
@@ -295,6 +302,10 @@ func (d *Dialog) TypeInfo() tdp.Type {
|
||||
Name: "UnreadReactionsCount",
|
||||
SchemaName: "unread_reactions_count",
|
||||
},
|
||||
{
|
||||
Name: "UnreadPollVotesCount",
|
||||
SchemaName: "unread_poll_votes_count",
|
||||
},
|
||||
{
|
||||
Name: "NotifySettings",
|
||||
SchemaName: "notify_settings",
|
||||
@@ -351,7 +362,7 @@ func (d *Dialog) SetFlags() {
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *Dialog) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dialog#d58a08c6 as nil")
|
||||
return fmt.Errorf("can't encode dialog#fc89f7f3 as nil")
|
||||
}
|
||||
b.PutID(DialogTypeID)
|
||||
return d.EncodeBare(b)
|
||||
@@ -360,17 +371,17 @@ func (d *Dialog) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *Dialog) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dialog#d58a08c6 as nil")
|
||||
return fmt.Errorf("can't encode dialog#fc89f7f3 as nil")
|
||||
}
|
||||
d.SetFlags()
|
||||
if err := d.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field flags: %w", err)
|
||||
}
|
||||
if d.Peer == nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field peer is nil")
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field peer is nil")
|
||||
}
|
||||
if err := d.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(d.TopMessage)
|
||||
b.PutInt(d.ReadInboxMaxID)
|
||||
@@ -378,18 +389,19 @@ func (d *Dialog) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(d.UnreadCount)
|
||||
b.PutInt(d.UnreadMentionsCount)
|
||||
b.PutInt(d.UnreadReactionsCount)
|
||||
b.PutInt(d.UnreadPollVotesCount)
|
||||
if err := d.NotifySettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field notify_settings: %w", err)
|
||||
}
|
||||
if d.Flags.Has(0) {
|
||||
b.PutInt(d.Pts)
|
||||
}
|
||||
if d.Flags.Has(1) {
|
||||
if d.Draft == nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field draft is nil")
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field draft is nil")
|
||||
}
|
||||
if err := d.Draft.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode dialog#d58a08c6: field draft: %w", err)
|
||||
return fmt.Errorf("unable to encode dialog#fc89f7f3: field draft: %w", err)
|
||||
}
|
||||
}
|
||||
if d.Flags.Has(4) {
|
||||
@@ -404,10 +416,10 @@ func (d *Dialog) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *Dialog) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dialog#d58a08c6 to nil")
|
||||
return fmt.Errorf("can't decode dialog#fc89f7f3 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DialogTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
@@ -415,11 +427,11 @@ func (d *Dialog) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *Dialog) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dialog#d58a08c6 to nil")
|
||||
return fmt.Errorf("can't decode dialog#fc89f7f3 to nil")
|
||||
}
|
||||
{
|
||||
if err := d.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
d.Pinned = d.Flags.Has(2)
|
||||
@@ -428,82 +440,89 @@ func (d *Dialog) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field peer: %w", err)
|
||||
}
|
||||
d.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field top_message: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field top_message: %w", err)
|
||||
}
|
||||
d.TopMessage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field read_inbox_max_id: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field read_inbox_max_id: %w", err)
|
||||
}
|
||||
d.ReadInboxMaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field read_outbox_max_id: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field read_outbox_max_id: %w", err)
|
||||
}
|
||||
d.ReadOutboxMaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_count: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field unread_count: %w", err)
|
||||
}
|
||||
d.UnreadCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_mentions_count: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field unread_mentions_count: %w", err)
|
||||
}
|
||||
d.UnreadMentionsCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field unread_reactions_count: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field unread_reactions_count: %w", err)
|
||||
}
|
||||
d.UnreadReactionsCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field unread_poll_votes_count: %w", err)
|
||||
}
|
||||
d.UnreadPollVotesCount = value
|
||||
}
|
||||
{
|
||||
if err := d.NotifySettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field notify_settings: %w", err)
|
||||
}
|
||||
}
|
||||
if d.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field pts: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field pts: %w", err)
|
||||
}
|
||||
d.Pts = value
|
||||
}
|
||||
if d.Flags.Has(1) {
|
||||
value, err := DecodeDraftMessage(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field draft: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field draft: %w", err)
|
||||
}
|
||||
d.Draft = value
|
||||
}
|
||||
if d.Flags.Has(4) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field folder_id: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field folder_id: %w", err)
|
||||
}
|
||||
d.FolderID = value
|
||||
}
|
||||
if d.Flags.Has(5) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dialog#d58a08c6: field ttl_period: %w", err)
|
||||
return fmt.Errorf("unable to decode dialog#fc89f7f3: field ttl_period: %w", err)
|
||||
}
|
||||
d.TTLPeriod = value
|
||||
}
|
||||
@@ -623,6 +642,14 @@ func (d *Dialog) GetUnreadReactionsCount() (value int) {
|
||||
return d.UnreadReactionsCount
|
||||
}
|
||||
|
||||
// GetUnreadPollVotesCount returns value of UnreadPollVotesCount field.
|
||||
func (d *Dialog) GetUnreadPollVotesCount() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.UnreadPollVotesCount
|
||||
}
|
||||
|
||||
// GetNotifySettings returns value of NotifySettings field.
|
||||
func (d *Dialog) GetNotifySettings() (value PeerNotifySettings) {
|
||||
if d == nil {
|
||||
@@ -1075,7 +1102,7 @@ const DialogClassName = "Dialog"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.Dialog: // dialog#d58a08c6
|
||||
// case *tg.Dialog: // dialog#fc89f7f3
|
||||
// case *tg.DialogFolder: // dialogFolder#71bd134c
|
||||
// default: panic(v)
|
||||
// }
|
||||
@@ -1125,7 +1152,7 @@ func DecodeDialog(buf *bin.Buffer) (DialogClass, error) {
|
||||
}
|
||||
switch id {
|
||||
case DialogTypeID:
|
||||
// Decoding dialog#d58a08c6.
|
||||
// Decoding dialog#fc89f7f3.
|
||||
v := Dialog{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode DialogClass: %w", err)
|
||||
|
||||
Generated
+60
-33
@@ -166,7 +166,7 @@ func (f *ForumTopicDeleted) GetID() (value int) {
|
||||
return f.ID
|
||||
}
|
||||
|
||||
// ForumTopic represents TL type `forumTopic#cdff0eca`.
|
||||
// ForumTopic represents TL type `forumTopic#fcdad815`.
|
||||
// Represents a forum topic¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -236,6 +236,8 @@ type ForumTopic struct {
|
||||
UnreadMentionsCount int
|
||||
// Number of unread reactions to messages you sent
|
||||
UnreadReactionsCount int
|
||||
// UnreadPollVotesCount field of ForumTopic.
|
||||
UnreadPollVotesCount int
|
||||
// ID of the peer that created the topic
|
||||
FromID PeerClass
|
||||
// Notification settings
|
||||
@@ -250,7 +252,7 @@ type ForumTopic struct {
|
||||
}
|
||||
|
||||
// ForumTopicTypeID is TL type id of ForumTopic.
|
||||
const ForumTopicTypeID = 0xcdff0eca
|
||||
const ForumTopicTypeID = 0xfcdad815
|
||||
|
||||
// construct implements constructor of ForumTopicClass.
|
||||
func (f ForumTopic) construct() ForumTopicClass { return &f }
|
||||
@@ -326,6 +328,9 @@ func (f *ForumTopic) Zero() bool {
|
||||
if !(f.UnreadReactionsCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.UnreadPollVotesCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.FromID == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -368,6 +373,7 @@ func (f *ForumTopic) FillFrom(from interface {
|
||||
GetUnreadCount() (value int)
|
||||
GetUnreadMentionsCount() (value int)
|
||||
GetUnreadReactionsCount() (value int)
|
||||
GetUnreadPollVotesCount() (value int)
|
||||
GetFromID() (value PeerClass)
|
||||
GetNotifySettings() (value PeerNotifySettings)
|
||||
GetDraft() (value DraftMessageClass, ok bool)
|
||||
@@ -393,6 +399,7 @@ func (f *ForumTopic) FillFrom(from interface {
|
||||
f.UnreadCount = from.GetUnreadCount()
|
||||
f.UnreadMentionsCount = from.GetUnreadMentionsCount()
|
||||
f.UnreadReactionsCount = from.GetUnreadReactionsCount()
|
||||
f.UnreadPollVotesCount = from.GetUnreadPollVotesCount()
|
||||
f.FromID = from.GetFromID()
|
||||
f.NotifySettings = from.GetNotifySettings()
|
||||
if val, ok := from.GetDraft(); ok {
|
||||
@@ -503,6 +510,10 @@ func (f *ForumTopic) TypeInfo() tdp.Type {
|
||||
Name: "UnreadReactionsCount",
|
||||
SchemaName: "unread_reactions_count",
|
||||
},
|
||||
{
|
||||
Name: "UnreadPollVotesCount",
|
||||
SchemaName: "unread_poll_votes_count",
|
||||
},
|
||||
{
|
||||
Name: "FromID",
|
||||
SchemaName: "from_id",
|
||||
@@ -551,7 +562,7 @@ func (f *ForumTopic) SetFlags() {
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *ForumTopic) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode forumTopic#cdff0eca as nil")
|
||||
return fmt.Errorf("can't encode forumTopic#fcdad815 as nil")
|
||||
}
|
||||
b.PutID(ForumTopicTypeID)
|
||||
return f.EncodeBare(b)
|
||||
@@ -560,19 +571,19 @@ func (f *ForumTopic) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *ForumTopic) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode forumTopic#cdff0eca as nil")
|
||||
return fmt.Errorf("can't encode forumTopic#fcdad815 as nil")
|
||||
}
|
||||
f.SetFlags()
|
||||
if err := f.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(f.ID)
|
||||
b.PutInt(f.Date)
|
||||
if f.Peer == nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field peer is nil")
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field peer is nil")
|
||||
}
|
||||
if err := f.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field peer: %w", err)
|
||||
}
|
||||
b.PutString(f.Title)
|
||||
b.PutInt(f.IconColor)
|
||||
@@ -585,21 +596,22 @@ func (f *ForumTopic) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(f.UnreadCount)
|
||||
b.PutInt(f.UnreadMentionsCount)
|
||||
b.PutInt(f.UnreadReactionsCount)
|
||||
b.PutInt(f.UnreadPollVotesCount)
|
||||
if f.FromID == nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field from_id is nil")
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field from_id is nil")
|
||||
}
|
||||
if err := f.FromID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field from_id: %w", err)
|
||||
}
|
||||
if err := f.NotifySettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field notify_settings: %w", err)
|
||||
}
|
||||
if f.Flags.Has(4) {
|
||||
if f.Draft == nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field draft is nil")
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field draft is nil")
|
||||
}
|
||||
if err := f.Draft.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode forumTopic#cdff0eca: field draft: %w", err)
|
||||
return fmt.Errorf("unable to encode forumTopic#fcdad815: field draft: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -608,10 +620,10 @@ func (f *ForumTopic) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *ForumTopic) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode forumTopic#cdff0eca to nil")
|
||||
return fmt.Errorf("can't decode forumTopic#fcdad815 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ForumTopicTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
@@ -619,11 +631,11 @@ func (f *ForumTopic) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *ForumTopic) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode forumTopic#cdff0eca to nil")
|
||||
return fmt.Errorf("can't decode forumTopic#fcdad815 to nil")
|
||||
}
|
||||
{
|
||||
if err := f.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
f.My = f.Flags.Has(1)
|
||||
@@ -635,103 +647,110 @@ func (f *ForumTopic) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field id: %w", err)
|
||||
}
|
||||
f.ID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field date: %w", err)
|
||||
}
|
||||
f.Date = value
|
||||
}
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field peer: %w", err)
|
||||
}
|
||||
f.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field title: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field title: %w", err)
|
||||
}
|
||||
f.Title = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field icon_color: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field icon_color: %w", err)
|
||||
}
|
||||
f.IconColor = value
|
||||
}
|
||||
if f.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field icon_emoji_id: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field icon_emoji_id: %w", err)
|
||||
}
|
||||
f.IconEmojiID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field top_message: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field top_message: %w", err)
|
||||
}
|
||||
f.TopMessage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field read_inbox_max_id: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field read_inbox_max_id: %w", err)
|
||||
}
|
||||
f.ReadInboxMaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field read_outbox_max_id: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field read_outbox_max_id: %w", err)
|
||||
}
|
||||
f.ReadOutboxMaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field unread_count: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field unread_count: %w", err)
|
||||
}
|
||||
f.UnreadCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field unread_mentions_count: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field unread_mentions_count: %w", err)
|
||||
}
|
||||
f.UnreadMentionsCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field unread_reactions_count: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field unread_reactions_count: %w", err)
|
||||
}
|
||||
f.UnreadReactionsCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field unread_poll_votes_count: %w", err)
|
||||
}
|
||||
f.UnreadPollVotesCount = value
|
||||
}
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field from_id: %w", err)
|
||||
}
|
||||
f.FromID = value
|
||||
}
|
||||
{
|
||||
if err := f.NotifySettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field notify_settings: %w", err)
|
||||
}
|
||||
}
|
||||
if f.Flags.Has(4) {
|
||||
value, err := DecodeDraftMessage(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode forumTopic#cdff0eca: field draft: %w", err)
|
||||
return fmt.Errorf("unable to decode forumTopic#fcdad815: field draft: %w", err)
|
||||
}
|
||||
f.Draft = value
|
||||
}
|
||||
@@ -958,6 +977,14 @@ func (f *ForumTopic) GetUnreadReactionsCount() (value int) {
|
||||
return f.UnreadReactionsCount
|
||||
}
|
||||
|
||||
// GetUnreadPollVotesCount returns value of UnreadPollVotesCount field.
|
||||
func (f *ForumTopic) GetUnreadPollVotesCount() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.UnreadPollVotesCount
|
||||
}
|
||||
|
||||
// GetFromID returns value of FromID field.
|
||||
func (f *ForumTopic) GetFromID() (value PeerClass) {
|
||||
if f == nil {
|
||||
@@ -1007,7 +1034,7 @@ const ForumTopicClassName = "ForumTopic"
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.ForumTopicDeleted: // forumTopicDeleted#23f109b
|
||||
// case *tg.ForumTopic: // forumTopic#cdff0eca
|
||||
// case *tg.ForumTopic: // forumTopic#fcdad815
|
||||
// default: panic(v)
|
||||
// }
|
||||
type ForumTopicClass interface {
|
||||
@@ -1047,7 +1074,7 @@ func DecodeForumTopic(buf *bin.Buffer) (ForumTopicClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case ForumTopicTypeID:
|
||||
// Decoding forumTopic#cdff0eca.
|
||||
// Decoding forumTopic#fcdad815.
|
||||
v := ForumTopic{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ForumTopicClass: %w", err)
|
||||
|
||||
Generated
+10
@@ -1561,6 +1561,16 @@ func (u UpdateDispatcher) OnChatParticipantRank(handler ChatParticipantRankHandl
|
||||
}
|
||||
}
|
||||
|
||||
// ManagedBotHandler is a ManagedBot event handler.
|
||||
type ManagedBotHandler func(ctx context.Context, e Entities, update *UpdateManagedBot) error
|
||||
|
||||
// OnManagedBot sets ManagedBot handler.
|
||||
func (u UpdateDispatcher) OnManagedBot(handler ManagedBotHandler) {
|
||||
u.handlers[UpdateManagedBotTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
||||
return handler(ctx, e, update.(*UpdateManagedBot))
|
||||
}
|
||||
}
|
||||
|
||||
// OnFallback sets fallback handler.
|
||||
func (u *UpdateDispatcher) OnFallback(handler Handler) {
|
||||
u.fallback = handler
|
||||
|
||||
Generated
+343
-61
@@ -133,7 +133,7 @@ func (i *InputMediaEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InputMediaUploadedPhoto represents TL type `inputMediaUploadedPhoto#1e287d04`.
|
||||
// InputMediaUploadedPhoto represents TL type `inputMediaUploadedPhoto#7d8375da`.
|
||||
// Photo
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMediaUploadedPhoto for reference.
|
||||
@@ -145,6 +145,8 @@ type InputMediaUploadedPhoto struct {
|
||||
Flags bin.Fields
|
||||
// Whether this media should be hidden behind a spoiler warning
|
||||
Spoiler bool
|
||||
// LivePhoto field of InputMediaUploadedPhoto.
|
||||
LivePhoto bool
|
||||
// The uploaded file¹
|
||||
//
|
||||
// Links:
|
||||
@@ -158,10 +160,14 @@ type InputMediaUploadedPhoto struct {
|
||||
//
|
||||
// Use SetTTLSeconds and GetTTLSeconds helpers.
|
||||
TTLSeconds int
|
||||
// Video field of InputMediaUploadedPhoto.
|
||||
//
|
||||
// Use SetVideo and GetVideo helpers.
|
||||
Video InputDocumentClass
|
||||
}
|
||||
|
||||
// InputMediaUploadedPhotoTypeID is TL type id of InputMediaUploadedPhoto.
|
||||
const InputMediaUploadedPhotoTypeID = 0x1e287d04
|
||||
const InputMediaUploadedPhotoTypeID = 0x7d8375da
|
||||
|
||||
// construct implements constructor of InputMediaClass.
|
||||
func (i InputMediaUploadedPhoto) construct() InputMediaClass { return &i }
|
||||
@@ -186,6 +192,9 @@ func (i *InputMediaUploadedPhoto) Zero() bool {
|
||||
if !(i.Spoiler == false) {
|
||||
return false
|
||||
}
|
||||
if !(i.LivePhoto == false) {
|
||||
return false
|
||||
}
|
||||
if !(i.File == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -195,6 +204,9 @@ func (i *InputMediaUploadedPhoto) Zero() bool {
|
||||
if !(i.TTLSeconds == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.Video == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -211,11 +223,14 @@ func (i *InputMediaUploadedPhoto) String() string {
|
||||
// FillFrom fills InputMediaUploadedPhoto from given interface.
|
||||
func (i *InputMediaUploadedPhoto) FillFrom(from interface {
|
||||
GetSpoiler() (value bool)
|
||||
GetLivePhoto() (value bool)
|
||||
GetFile() (value InputFileClass)
|
||||
GetStickers() (value []InputDocumentClass, ok bool)
|
||||
GetTTLSeconds() (value int, ok bool)
|
||||
GetVideo() (value InputDocumentClass, ok bool)
|
||||
}) {
|
||||
i.Spoiler = from.GetSpoiler()
|
||||
i.LivePhoto = from.GetLivePhoto()
|
||||
i.File = from.GetFile()
|
||||
if val, ok := from.GetStickers(); ok {
|
||||
i.Stickers = val
|
||||
@@ -225,6 +240,10 @@ func (i *InputMediaUploadedPhoto) FillFrom(from interface {
|
||||
i.TTLSeconds = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetVideo(); ok {
|
||||
i.Video = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -255,6 +274,11 @@ func (i *InputMediaUploadedPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "spoiler",
|
||||
Null: !i.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "LivePhoto",
|
||||
SchemaName: "live_photo",
|
||||
Null: !i.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "File",
|
||||
SchemaName: "file",
|
||||
@@ -269,6 +293,11 @@ func (i *InputMediaUploadedPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "ttl_seconds",
|
||||
Null: !i.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "Video",
|
||||
SchemaName: "video",
|
||||
Null: !i.Flags.Has(3),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -278,18 +307,24 @@ func (i *InputMediaUploadedPhoto) SetFlags() {
|
||||
if !(i.Spoiler == false) {
|
||||
i.Flags.Set(2)
|
||||
}
|
||||
if !(i.LivePhoto == false) {
|
||||
i.Flags.Set(3)
|
||||
}
|
||||
if !(i.Stickers == nil) {
|
||||
i.Flags.Set(0)
|
||||
}
|
||||
if !(i.TTLSeconds == 0) {
|
||||
i.Flags.Set(1)
|
||||
}
|
||||
if !(i.Video == nil) {
|
||||
i.Flags.Set(3)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMediaUploadedPhoto) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaUploadedPhoto#1e287d04 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaUploadedPhoto#7d8375da as nil")
|
||||
}
|
||||
b.PutID(InputMediaUploadedPhotoTypeID)
|
||||
return i.EncodeBare(b)
|
||||
@@ -298,42 +333,50 @@ func (i *InputMediaUploadedPhoto) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMediaUploadedPhoto) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaUploadedPhoto#1e287d04 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaUploadedPhoto#7d8375da as nil")
|
||||
}
|
||||
i.SetFlags()
|
||||
if err := i.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#1e287d04: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field flags: %w", err)
|
||||
}
|
||||
if i.File == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#1e287d04: field file is nil")
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field file is nil")
|
||||
}
|
||||
if err := i.File.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#1e287d04: field file: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field file: %w", err)
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
b.PutVectorHeader(len(i.Stickers))
|
||||
for idx, v := range i.Stickers {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#1e287d04: field stickers element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field stickers element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#1e287d04: field stickers element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field stickers element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
b.PutInt(i.TTLSeconds)
|
||||
}
|
||||
if i.Flags.Has(3) {
|
||||
if i.Video == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field video is nil")
|
||||
}
|
||||
if err := i.Video.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field video: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMediaUploadedPhoto) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaUploadedPhoto#1e287d04 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaUploadedPhoto#7d8375da to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMediaUploadedPhotoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
@@ -341,25 +384,26 @@ func (i *InputMediaUploadedPhoto) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMediaUploadedPhoto) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaUploadedPhoto#1e287d04 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaUploadedPhoto#7d8375da to nil")
|
||||
}
|
||||
{
|
||||
if err := i.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
i.Spoiler = i.Flags.Has(2)
|
||||
i.LivePhoto = i.Flags.Has(3)
|
||||
{
|
||||
value, err := DecodeInputFile(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: field file: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field file: %w", err)
|
||||
}
|
||||
i.File = value
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: field stickers: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field stickers: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -368,7 +412,7 @@ func (i *InputMediaUploadedPhoto) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: field stickers: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field stickers: %w", err)
|
||||
}
|
||||
i.Stickers = append(i.Stickers, value)
|
||||
}
|
||||
@@ -376,10 +420,17 @@ func (i *InputMediaUploadedPhoto) DecodeBare(b *bin.Buffer) error {
|
||||
if i.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#1e287d04: field ttl_seconds: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field ttl_seconds: %w", err)
|
||||
}
|
||||
i.TTLSeconds = value
|
||||
}
|
||||
if i.Flags.Has(3) {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field video: %w", err)
|
||||
}
|
||||
i.Video = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -402,6 +453,25 @@ func (i *InputMediaUploadedPhoto) GetSpoiler() (value bool) {
|
||||
return i.Flags.Has(2)
|
||||
}
|
||||
|
||||
// SetLivePhoto sets value of LivePhoto conditional field.
|
||||
func (i *InputMediaUploadedPhoto) SetLivePhoto(value bool) {
|
||||
if value {
|
||||
i.Flags.Set(3)
|
||||
i.LivePhoto = true
|
||||
} else {
|
||||
i.Flags.Unset(3)
|
||||
i.LivePhoto = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetLivePhoto returns value of LivePhoto conditional field.
|
||||
func (i *InputMediaUploadedPhoto) GetLivePhoto() (value bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Flags.Has(3)
|
||||
}
|
||||
|
||||
// GetFile returns value of File field.
|
||||
func (i *InputMediaUploadedPhoto) GetFile() (value InputFileClass) {
|
||||
if i == nil {
|
||||
@@ -446,6 +516,24 @@ func (i *InputMediaUploadedPhoto) GetTTLSeconds() (value int, ok bool) {
|
||||
return i.TTLSeconds, true
|
||||
}
|
||||
|
||||
// SetVideo sets value of Video conditional field.
|
||||
func (i *InputMediaUploadedPhoto) SetVideo(value InputDocumentClass) {
|
||||
i.Flags.Set(3)
|
||||
i.Video = value
|
||||
}
|
||||
|
||||
// GetVideo returns value of Video conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputMediaUploadedPhoto) GetVideo() (value InputDocumentClass, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(3) {
|
||||
return value, false
|
||||
}
|
||||
return i.Video, true
|
||||
}
|
||||
|
||||
// MapStickers returns field Stickers wrapped in InputDocumentClassArray helper.
|
||||
func (i *InputMediaUploadedPhoto) MapStickers() (value InputDocumentClassArray, ok bool) {
|
||||
if !i.Flags.Has(0) {
|
||||
@@ -454,7 +542,7 @@ func (i *InputMediaUploadedPhoto) MapStickers() (value InputDocumentClassArray,
|
||||
return InputDocumentClassArray(i.Stickers), true
|
||||
}
|
||||
|
||||
// InputMediaPhoto represents TL type `inputMediaPhoto#b3ba0635`.
|
||||
// InputMediaPhoto represents TL type `inputMediaPhoto#e3af4434`.
|
||||
// Forwarded photo
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMediaPhoto for reference.
|
||||
@@ -466,16 +554,22 @@ type InputMediaPhoto struct {
|
||||
Flags bin.Fields
|
||||
// Whether this media should be hidden behind a spoiler warning
|
||||
Spoiler bool
|
||||
// LivePhoto field of InputMediaPhoto.
|
||||
LivePhoto bool
|
||||
// Photo to be forwarded
|
||||
ID InputPhotoClass
|
||||
// Time to live in seconds of self-destructing photo
|
||||
//
|
||||
// Use SetTTLSeconds and GetTTLSeconds helpers.
|
||||
TTLSeconds int
|
||||
// Video field of InputMediaPhoto.
|
||||
//
|
||||
// Use SetVideo and GetVideo helpers.
|
||||
Video InputDocumentClass
|
||||
}
|
||||
|
||||
// InputMediaPhotoTypeID is TL type id of InputMediaPhoto.
|
||||
const InputMediaPhotoTypeID = 0xb3ba0635
|
||||
const InputMediaPhotoTypeID = 0xe3af4434
|
||||
|
||||
// construct implements constructor of InputMediaClass.
|
||||
func (i InputMediaPhoto) construct() InputMediaClass { return &i }
|
||||
@@ -500,12 +594,18 @@ func (i *InputMediaPhoto) Zero() bool {
|
||||
if !(i.Spoiler == false) {
|
||||
return false
|
||||
}
|
||||
if !(i.LivePhoto == false) {
|
||||
return false
|
||||
}
|
||||
if !(i.ID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.TTLSeconds == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.Video == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -522,15 +622,22 @@ func (i *InputMediaPhoto) String() string {
|
||||
// FillFrom fills InputMediaPhoto from given interface.
|
||||
func (i *InputMediaPhoto) FillFrom(from interface {
|
||||
GetSpoiler() (value bool)
|
||||
GetLivePhoto() (value bool)
|
||||
GetID() (value InputPhotoClass)
|
||||
GetTTLSeconds() (value int, ok bool)
|
||||
GetVideo() (value InputDocumentClass, ok bool)
|
||||
}) {
|
||||
i.Spoiler = from.GetSpoiler()
|
||||
i.LivePhoto = from.GetLivePhoto()
|
||||
i.ID = from.GetID()
|
||||
if val, ok := from.GetTTLSeconds(); ok {
|
||||
i.TTLSeconds = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetVideo(); ok {
|
||||
i.Video = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -561,6 +668,11 @@ func (i *InputMediaPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "spoiler",
|
||||
Null: !i.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "LivePhoto",
|
||||
SchemaName: "live_photo",
|
||||
Null: !i.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
@@ -570,6 +682,11 @@ func (i *InputMediaPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "ttl_seconds",
|
||||
Null: !i.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Video",
|
||||
SchemaName: "video",
|
||||
Null: !i.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -579,15 +696,21 @@ func (i *InputMediaPhoto) SetFlags() {
|
||||
if !(i.Spoiler == false) {
|
||||
i.Flags.Set(1)
|
||||
}
|
||||
if !(i.LivePhoto == false) {
|
||||
i.Flags.Set(2)
|
||||
}
|
||||
if !(i.TTLSeconds == 0) {
|
||||
i.Flags.Set(0)
|
||||
}
|
||||
if !(i.Video == nil) {
|
||||
i.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMediaPhoto) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaPhoto#b3ba0635 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaPhoto#e3af4434 as nil")
|
||||
}
|
||||
b.PutID(InputMediaPhotoTypeID)
|
||||
return i.EncodeBare(b)
|
||||
@@ -596,31 +719,39 @@ func (i *InputMediaPhoto) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMediaPhoto) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaPhoto#b3ba0635 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaPhoto#e3af4434 as nil")
|
||||
}
|
||||
i.SetFlags()
|
||||
if err := i.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#b3ba0635: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field flags: %w", err)
|
||||
}
|
||||
if i.ID == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#b3ba0635: field id is nil")
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field id is nil")
|
||||
}
|
||||
if err := i.ID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#b3ba0635: field id: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field id: %w", err)
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
b.PutInt(i.TTLSeconds)
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
if i.Video == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field video is nil")
|
||||
}
|
||||
if err := i.Video.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field video: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMediaPhoto) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaPhoto#b3ba0635 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaPhoto#e3af4434 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMediaPhotoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
@@ -628,28 +759,36 @@ func (i *InputMediaPhoto) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMediaPhoto) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaPhoto#b3ba0635 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaPhoto#e3af4434 to nil")
|
||||
}
|
||||
{
|
||||
if err := i.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
i.Spoiler = i.Flags.Has(1)
|
||||
i.LivePhoto = i.Flags.Has(2)
|
||||
{
|
||||
value, err := DecodeInputPhoto(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field id: %w", err)
|
||||
}
|
||||
i.ID = value
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field ttl_seconds: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field ttl_seconds: %w", err)
|
||||
}
|
||||
i.TTLSeconds = value
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field video: %w", err)
|
||||
}
|
||||
i.Video = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -672,6 +811,25 @@ func (i *InputMediaPhoto) GetSpoiler() (value bool) {
|
||||
return i.Flags.Has(1)
|
||||
}
|
||||
|
||||
// SetLivePhoto sets value of LivePhoto conditional field.
|
||||
func (i *InputMediaPhoto) SetLivePhoto(value bool) {
|
||||
if value {
|
||||
i.Flags.Set(2)
|
||||
i.LivePhoto = true
|
||||
} else {
|
||||
i.Flags.Unset(2)
|
||||
i.LivePhoto = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetLivePhoto returns value of LivePhoto conditional field.
|
||||
func (i *InputMediaPhoto) GetLivePhoto() (value bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Flags.Has(2)
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (i *InputMediaPhoto) GetID() (value InputPhotoClass) {
|
||||
if i == nil {
|
||||
@@ -698,6 +856,24 @@ func (i *InputMediaPhoto) GetTTLSeconds() (value int, ok bool) {
|
||||
return i.TTLSeconds, true
|
||||
}
|
||||
|
||||
// SetVideo sets value of Video conditional field.
|
||||
func (i *InputMediaPhoto) SetVideo(value InputDocumentClass) {
|
||||
i.Flags.Set(2)
|
||||
i.Video = value
|
||||
}
|
||||
|
||||
// GetVideo returns value of Video conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputMediaPhoto) GetVideo() (value InputDocumentClass, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return i.Video, true
|
||||
}
|
||||
|
||||
// InputMediaGeoPoint represents TL type `inputMediaGeoPoint#f9c44144`.
|
||||
// Map.
|
||||
//
|
||||
@@ -3898,7 +4074,7 @@ func (i *InputMediaGeoLive) GetProximityNotificationRadius() (value int, ok bool
|
||||
return i.ProximityNotificationRadius, true
|
||||
}
|
||||
|
||||
// InputMediaPoll represents TL type `inputMediaPoll#f94e5f1`.
|
||||
// InputMediaPoll represents TL type `inputMediaPoll#883a4108`.
|
||||
// A poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMediaPoll for reference.
|
||||
@@ -3913,7 +4089,11 @@ type InputMediaPoll struct {
|
||||
// Correct answer IDs (for quiz polls)
|
||||
//
|
||||
// Use SetCorrectAnswers and GetCorrectAnswers helpers.
|
||||
CorrectAnswers [][]byte
|
||||
CorrectAnswers []int
|
||||
// AttachedMedia field of InputMediaPoll.
|
||||
//
|
||||
// Use SetAttachedMedia and GetAttachedMedia helpers.
|
||||
AttachedMedia InputMediaClass
|
||||
// Explanation of quiz solution
|
||||
//
|
||||
// Use SetSolution and GetSolution helpers.
|
||||
@@ -3925,10 +4105,14 @@ type InputMediaPoll struct {
|
||||
//
|
||||
// Use SetSolutionEntities and GetSolutionEntities helpers.
|
||||
SolutionEntities []MessageEntityClass
|
||||
// SolutionMedia field of InputMediaPoll.
|
||||
//
|
||||
// Use SetSolutionMedia and GetSolutionMedia helpers.
|
||||
SolutionMedia InputMediaClass
|
||||
}
|
||||
|
||||
// InputMediaPollTypeID is TL type id of InputMediaPoll.
|
||||
const InputMediaPollTypeID = 0xf94e5f1
|
||||
const InputMediaPollTypeID = 0x883a4108
|
||||
|
||||
// construct implements constructor of InputMediaClass.
|
||||
func (i InputMediaPoll) construct() InputMediaClass { return &i }
|
||||
@@ -3956,12 +4140,18 @@ func (i *InputMediaPoll) Zero() bool {
|
||||
if !(i.CorrectAnswers == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.AttachedMedia == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.Solution == "") {
|
||||
return false
|
||||
}
|
||||
if !(i.SolutionEntities == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.SolutionMedia == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -3978,15 +4168,21 @@ func (i *InputMediaPoll) String() string {
|
||||
// FillFrom fills InputMediaPoll from given interface.
|
||||
func (i *InputMediaPoll) FillFrom(from interface {
|
||||
GetPoll() (value Poll)
|
||||
GetCorrectAnswers() (value [][]byte, ok bool)
|
||||
GetCorrectAnswers() (value []int, ok bool)
|
||||
GetAttachedMedia() (value InputMediaClass, ok bool)
|
||||
GetSolution() (value string, ok bool)
|
||||
GetSolutionEntities() (value []MessageEntityClass, ok bool)
|
||||
GetSolutionMedia() (value InputMediaClass, ok bool)
|
||||
}) {
|
||||
i.Poll = from.GetPoll()
|
||||
if val, ok := from.GetCorrectAnswers(); ok {
|
||||
i.CorrectAnswers = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetAttachedMedia(); ok {
|
||||
i.AttachedMedia = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSolution(); ok {
|
||||
i.Solution = val
|
||||
}
|
||||
@@ -3995,6 +4191,10 @@ func (i *InputMediaPoll) FillFrom(from interface {
|
||||
i.SolutionEntities = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSolutionMedia(); ok {
|
||||
i.SolutionMedia = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -4029,6 +4229,11 @@ func (i *InputMediaPoll) TypeInfo() tdp.Type {
|
||||
SchemaName: "correct_answers",
|
||||
Null: !i.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "AttachedMedia",
|
||||
SchemaName: "attached_media",
|
||||
Null: !i.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "Solution",
|
||||
SchemaName: "solution",
|
||||
@@ -4039,6 +4244,11 @@ func (i *InputMediaPoll) TypeInfo() tdp.Type {
|
||||
SchemaName: "solution_entities",
|
||||
Null: !i.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "SolutionMedia",
|
||||
SchemaName: "solution_media",
|
||||
Null: !i.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -4048,18 +4258,24 @@ func (i *InputMediaPoll) SetFlags() {
|
||||
if !(i.CorrectAnswers == nil) {
|
||||
i.Flags.Set(0)
|
||||
}
|
||||
if !(i.AttachedMedia == nil) {
|
||||
i.Flags.Set(3)
|
||||
}
|
||||
if !(i.Solution == "") {
|
||||
i.Flags.Set(1)
|
||||
}
|
||||
if !(i.SolutionEntities == nil) {
|
||||
i.Flags.Set(1)
|
||||
}
|
||||
if !(i.SolutionMedia == nil) {
|
||||
i.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMediaPoll) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaPoll#f94e5f1 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaPoll#883a4108 as nil")
|
||||
}
|
||||
b.PutID(InputMediaPollTypeID)
|
||||
return i.EncodeBare(b)
|
||||
@@ -4068,19 +4284,27 @@ func (i *InputMediaPoll) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMediaPoll) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaPoll#f94e5f1 as nil")
|
||||
return fmt.Errorf("can't encode inputMediaPoll#883a4108 as nil")
|
||||
}
|
||||
i.SetFlags()
|
||||
if err := i.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field flags: %w", err)
|
||||
}
|
||||
if err := i.Poll.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field poll: %w", err)
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field poll: %w", err)
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
b.PutVectorHeader(len(i.CorrectAnswers))
|
||||
for _, v := range i.CorrectAnswers {
|
||||
b.PutBytes(v)
|
||||
b.PutInt(v)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(3) {
|
||||
if i.AttachedMedia == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field attached_media is nil")
|
||||
}
|
||||
if err := i.AttachedMedia.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field attached_media: %w", err)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
@@ -4090,23 +4314,31 @@ func (i *InputMediaPoll) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(i.SolutionEntities))
|
||||
for idx, v := range i.SolutionEntities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field solution_entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field solution_entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
if i.SolutionMedia == nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_media is nil")
|
||||
}
|
||||
if err := i.SolutionMedia.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_media: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMediaPoll) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaPoll#f94e5f1 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaPoll#883a4108 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMediaPollTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
@@ -4114,46 +4346,53 @@ func (i *InputMediaPoll) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMediaPoll) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaPoll#f94e5f1 to nil")
|
||||
return fmt.Errorf("can't decode inputMediaPoll#883a4108 to nil")
|
||||
}
|
||||
{
|
||||
if err := i.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := i.Poll.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field poll: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field poll: %w", err)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field correct_answers: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field correct_answers: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
i.CorrectAnswers = make([][]byte, 0, headerLen%bin.PreallocateLimit)
|
||||
i.CorrectAnswers = make([]int, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Bytes()
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field correct_answers: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field correct_answers: %w", err)
|
||||
}
|
||||
i.CorrectAnswers = append(i.CorrectAnswers, value)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(3) {
|
||||
value, err := DecodeInputMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field attached_media: %w", err)
|
||||
}
|
||||
i.AttachedMedia = value
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field solution: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution: %w", err)
|
||||
}
|
||||
i.Solution = value
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field solution_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -4162,11 +4401,18 @@ func (i *InputMediaPoll) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field solution_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_entities: %w", err)
|
||||
}
|
||||
i.SolutionEntities = append(i.SolutionEntities, value)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
value, err := DecodeInputMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_media: %w", err)
|
||||
}
|
||||
i.SolutionMedia = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4179,14 +4425,14 @@ func (i *InputMediaPoll) GetPoll() (value Poll) {
|
||||
}
|
||||
|
||||
// SetCorrectAnswers sets value of CorrectAnswers conditional field.
|
||||
func (i *InputMediaPoll) SetCorrectAnswers(value [][]byte) {
|
||||
func (i *InputMediaPoll) SetCorrectAnswers(value []int) {
|
||||
i.Flags.Set(0)
|
||||
i.CorrectAnswers = value
|
||||
}
|
||||
|
||||
// GetCorrectAnswers returns value of CorrectAnswers conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputMediaPoll) GetCorrectAnswers() (value [][]byte, ok bool) {
|
||||
func (i *InputMediaPoll) GetCorrectAnswers() (value []int, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
@@ -4196,6 +4442,24 @@ func (i *InputMediaPoll) GetCorrectAnswers() (value [][]byte, ok bool) {
|
||||
return i.CorrectAnswers, true
|
||||
}
|
||||
|
||||
// SetAttachedMedia sets value of AttachedMedia conditional field.
|
||||
func (i *InputMediaPoll) SetAttachedMedia(value InputMediaClass) {
|
||||
i.Flags.Set(3)
|
||||
i.AttachedMedia = value
|
||||
}
|
||||
|
||||
// GetAttachedMedia returns value of AttachedMedia conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputMediaPoll) GetAttachedMedia() (value InputMediaClass, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(3) {
|
||||
return value, false
|
||||
}
|
||||
return i.AttachedMedia, true
|
||||
}
|
||||
|
||||
// SetSolution sets value of Solution conditional field.
|
||||
func (i *InputMediaPoll) SetSolution(value string) {
|
||||
i.Flags.Set(1)
|
||||
@@ -4232,6 +4496,24 @@ func (i *InputMediaPoll) GetSolutionEntities() (value []MessageEntityClass, ok b
|
||||
return i.SolutionEntities, true
|
||||
}
|
||||
|
||||
// SetSolutionMedia sets value of SolutionMedia conditional field.
|
||||
func (i *InputMediaPoll) SetSolutionMedia(value InputMediaClass) {
|
||||
i.Flags.Set(2)
|
||||
i.SolutionMedia = value
|
||||
}
|
||||
|
||||
// GetSolutionMedia returns value of SolutionMedia conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputMediaPoll) GetSolutionMedia() (value InputMediaClass, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return i.SolutionMedia, true
|
||||
}
|
||||
|
||||
// MapSolutionEntities returns field SolutionEntities wrapped in MessageEntityClassArray helper.
|
||||
func (i *InputMediaPoll) MapSolutionEntities() (value MessageEntityClassArray, ok bool) {
|
||||
if !i.Flags.Has(1) {
|
||||
@@ -5416,8 +5698,8 @@ const InputMediaClassName = "InputMedia"
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.InputMediaEmpty: // inputMediaEmpty#9664f57f
|
||||
// case *tg.InputMediaUploadedPhoto: // inputMediaUploadedPhoto#1e287d04
|
||||
// case *tg.InputMediaPhoto: // inputMediaPhoto#b3ba0635
|
||||
// case *tg.InputMediaUploadedPhoto: // inputMediaUploadedPhoto#7d8375da
|
||||
// case *tg.InputMediaPhoto: // inputMediaPhoto#e3af4434
|
||||
// case *tg.InputMediaGeoPoint: // inputMediaGeoPoint#f9c44144
|
||||
// case *tg.InputMediaContact: // inputMediaContact#f8ab7dfb
|
||||
// case *tg.InputMediaUploadedDocument: // inputMediaUploadedDocument#37c9330
|
||||
@@ -5428,7 +5710,7 @@ const InputMediaClassName = "InputMedia"
|
||||
// case *tg.InputMediaGame: // inputMediaGame#d33f43f3
|
||||
// case *tg.InputMediaInvoice: // inputMediaInvoice#405fef0d
|
||||
// case *tg.InputMediaGeoLive: // inputMediaGeoLive#971fa843
|
||||
// case *tg.InputMediaPoll: // inputMediaPoll#f94e5f1
|
||||
// case *tg.InputMediaPoll: // inputMediaPoll#883a4108
|
||||
// case *tg.InputMediaDice: // inputMediaDice#e66fbf7b
|
||||
// case *tg.InputMediaStory: // inputMediaStory#89fdd778
|
||||
// case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849
|
||||
@@ -5471,14 +5753,14 @@ func DecodeInputMedia(buf *bin.Buffer) (InputMediaClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case InputMediaUploadedPhotoTypeID:
|
||||
// Decoding inputMediaUploadedPhoto#1e287d04.
|
||||
// Decoding inputMediaUploadedPhoto#7d8375da.
|
||||
v := InputMediaUploadedPhoto{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputMediaPhotoTypeID:
|
||||
// Decoding inputMediaPhoto#b3ba0635.
|
||||
// Decoding inputMediaPhoto#e3af4434.
|
||||
v := InputMediaPhoto{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err)
|
||||
@@ -5555,7 +5837,7 @@ func DecodeInputMedia(buf *bin.Buffer) (InputMediaClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case InputMediaPollTypeID:
|
||||
// Decoding inputMediaPoll#f94e5f1.
|
||||
// Decoding inputMediaPoll#883a4108.
|
||||
v := InputMediaPoll{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err)
|
||||
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// InputMessageReadMetric represents TL type `inputMessageReadMetric#402b4495`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMessageReadMetric for reference.
|
||||
type InputMessageReadMetric struct {
|
||||
// MsgID field of InputMessageReadMetric.
|
||||
MsgID int
|
||||
// ViewID field of InputMessageReadMetric.
|
||||
ViewID int64
|
||||
// TimeInViewMs field of InputMessageReadMetric.
|
||||
TimeInViewMs int
|
||||
// ActiveTimeInViewMs field of InputMessageReadMetric.
|
||||
ActiveTimeInViewMs int
|
||||
// HeightToViewportRatioPermille field of InputMessageReadMetric.
|
||||
HeightToViewportRatioPermille int
|
||||
// SeenRangeRatioPermille field of InputMessageReadMetric.
|
||||
SeenRangeRatioPermille int
|
||||
}
|
||||
|
||||
// InputMessageReadMetricTypeID is TL type id of InputMessageReadMetric.
|
||||
const InputMessageReadMetricTypeID = 0x402b4495
|
||||
|
||||
// Ensuring interfaces in compile-time for InputMessageReadMetric.
|
||||
var (
|
||||
_ bin.Encoder = &InputMessageReadMetric{}
|
||||
_ bin.Decoder = &InputMessageReadMetric{}
|
||||
_ bin.BareEncoder = &InputMessageReadMetric{}
|
||||
_ bin.BareDecoder = &InputMessageReadMetric{}
|
||||
)
|
||||
|
||||
func (i *InputMessageReadMetric) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.ViewID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.TimeInViewMs == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.ActiveTimeInViewMs == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.HeightToViewportRatioPermille == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.SeenRangeRatioPermille == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputMessageReadMetric) String() string {
|
||||
if i == nil {
|
||||
return "InputMessageReadMetric(nil)"
|
||||
}
|
||||
type Alias InputMessageReadMetric
|
||||
return fmt.Sprintf("InputMessageReadMetric%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputMessageReadMetric from given interface.
|
||||
func (i *InputMessageReadMetric) FillFrom(from interface {
|
||||
GetMsgID() (value int)
|
||||
GetViewID() (value int64)
|
||||
GetTimeInViewMs() (value int)
|
||||
GetActiveTimeInViewMs() (value int)
|
||||
GetHeightToViewportRatioPermille() (value int)
|
||||
GetSeenRangeRatioPermille() (value int)
|
||||
}) {
|
||||
i.MsgID = from.GetMsgID()
|
||||
i.ViewID = from.GetViewID()
|
||||
i.TimeInViewMs = from.GetTimeInViewMs()
|
||||
i.ActiveTimeInViewMs = from.GetActiveTimeInViewMs()
|
||||
i.HeightToViewportRatioPermille = from.GetHeightToViewportRatioPermille()
|
||||
i.SeenRangeRatioPermille = from.GetSeenRangeRatioPermille()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputMessageReadMetric) TypeID() uint32 {
|
||||
return InputMessageReadMetricTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputMessageReadMetric) TypeName() string {
|
||||
return "inputMessageReadMetric"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputMessageReadMetric) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputMessageReadMetric",
|
||||
ID: InputMessageReadMetricTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "ViewID",
|
||||
SchemaName: "view_id",
|
||||
},
|
||||
{
|
||||
Name: "TimeInViewMs",
|
||||
SchemaName: "time_in_view_ms",
|
||||
},
|
||||
{
|
||||
Name: "ActiveTimeInViewMs",
|
||||
SchemaName: "active_time_in_view_ms",
|
||||
},
|
||||
{
|
||||
Name: "HeightToViewportRatioPermille",
|
||||
SchemaName: "height_to_viewport_ratio_permille",
|
||||
},
|
||||
{
|
||||
Name: "SeenRangeRatioPermille",
|
||||
SchemaName: "seen_range_ratio_permille",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMessageReadMetric) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMessageReadMetric#402b4495 as nil")
|
||||
}
|
||||
b.PutID(InputMessageReadMetricTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMessageReadMetric) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMessageReadMetric#402b4495 as nil")
|
||||
}
|
||||
b.PutInt(i.MsgID)
|
||||
b.PutLong(i.ViewID)
|
||||
b.PutInt(i.TimeInViewMs)
|
||||
b.PutInt(i.ActiveTimeInViewMs)
|
||||
b.PutInt(i.HeightToViewportRatioPermille)
|
||||
b.PutInt(i.SeenRangeRatioPermille)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMessageReadMetric) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMessageReadMetric#402b4495 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMessageReadMetricTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMessageReadMetric) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMessageReadMetric#402b4495 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field msg_id: %w", err)
|
||||
}
|
||||
i.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field view_id: %w", err)
|
||||
}
|
||||
i.ViewID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field time_in_view_ms: %w", err)
|
||||
}
|
||||
i.TimeInViewMs = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field active_time_in_view_ms: %w", err)
|
||||
}
|
||||
i.ActiveTimeInViewMs = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field height_to_viewport_ratio_permille: %w", err)
|
||||
}
|
||||
i.HeightToViewportRatioPermille = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessageReadMetric#402b4495: field seen_range_ratio_permille: %w", err)
|
||||
}
|
||||
i.SeenRangeRatioPermille = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (i *InputMessageReadMetric) GetMsgID() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.MsgID
|
||||
}
|
||||
|
||||
// GetViewID returns value of ViewID field.
|
||||
func (i *InputMessageReadMetric) GetViewID() (value int64) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ViewID
|
||||
}
|
||||
|
||||
// GetTimeInViewMs returns value of TimeInViewMs field.
|
||||
func (i *InputMessageReadMetric) GetTimeInViewMs() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.TimeInViewMs
|
||||
}
|
||||
|
||||
// GetActiveTimeInViewMs returns value of ActiveTimeInViewMs field.
|
||||
func (i *InputMessageReadMetric) GetActiveTimeInViewMs() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ActiveTimeInViewMs
|
||||
}
|
||||
|
||||
// GetHeightToViewportRatioPermille returns value of HeightToViewportRatioPermille field.
|
||||
func (i *InputMessageReadMetric) GetHeightToViewportRatioPermille() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.HeightToViewportRatioPermille
|
||||
}
|
||||
|
||||
// GetSeenRangeRatioPermille returns value of SeenRangeRatioPermille field.
|
||||
func (i *InputMessageReadMetric) GetSeenRangeRatioPermille() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.SeenRangeRatioPermille
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
Generated
+74
-26
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// InputReplyToMessage represents TL type `inputReplyToMessage#869fbe10`.
|
||||
// InputReplyToMessage represents TL type `inputReplyToMessage#3bd4b7c2`.
|
||||
// Reply to a message.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputReplyToMessage for reference.
|
||||
@@ -93,10 +93,14 @@ type InputReplyToMessage struct {
|
||||
//
|
||||
// Use SetTodoItemID and GetTodoItemID helpers.
|
||||
TodoItemID int
|
||||
// PollOption field of InputReplyToMessage.
|
||||
//
|
||||
// Use SetPollOption and GetPollOption helpers.
|
||||
PollOption []byte
|
||||
}
|
||||
|
||||
// InputReplyToMessageTypeID is TL type id of InputReplyToMessage.
|
||||
const InputReplyToMessageTypeID = 0x869fbe10
|
||||
const InputReplyToMessageTypeID = 0x3bd4b7c2
|
||||
|
||||
// construct implements constructor of InputReplyToClass.
|
||||
func (i InputReplyToMessage) construct() InputReplyToClass { return &i }
|
||||
@@ -142,6 +146,9 @@ func (i *InputReplyToMessage) Zero() bool {
|
||||
if !(i.TodoItemID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.PollOption == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -165,6 +172,7 @@ func (i *InputReplyToMessage) FillFrom(from interface {
|
||||
GetQuoteOffset() (value int, ok bool)
|
||||
GetMonoforumPeerID() (value InputPeerClass, ok bool)
|
||||
GetTodoItemID() (value int, ok bool)
|
||||
GetPollOption() (value []byte, ok bool)
|
||||
}) {
|
||||
i.ReplyToMsgID = from.GetReplyToMsgID()
|
||||
if val, ok := from.GetTopMsgID(); ok {
|
||||
@@ -195,6 +203,10 @@ func (i *InputReplyToMessage) FillFrom(from interface {
|
||||
i.TodoItemID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetPollOption(); ok {
|
||||
i.PollOption = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -259,6 +271,11 @@ func (i *InputReplyToMessage) TypeInfo() tdp.Type {
|
||||
SchemaName: "todo_item_id",
|
||||
Null: !i.Flags.Has(6),
|
||||
},
|
||||
{
|
||||
Name: "PollOption",
|
||||
SchemaName: "poll_option",
|
||||
Null: !i.Flags.Has(7),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -286,12 +303,15 @@ func (i *InputReplyToMessage) SetFlags() {
|
||||
if !(i.TodoItemID == 0) {
|
||||
i.Flags.Set(6)
|
||||
}
|
||||
if !(i.PollOption == nil) {
|
||||
i.Flags.Set(7)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputReplyToMessage) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputReplyToMessage#869fbe10 as nil")
|
||||
return fmt.Errorf("can't encode inputReplyToMessage#3bd4b7c2 as nil")
|
||||
}
|
||||
b.PutID(InputReplyToMessageTypeID)
|
||||
return i.EncodeBare(b)
|
||||
@@ -300,11 +320,11 @@ func (i *InputReplyToMessage) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputReplyToMessage#869fbe10 as nil")
|
||||
return fmt.Errorf("can't encode inputReplyToMessage#3bd4b7c2 as nil")
|
||||
}
|
||||
i.SetFlags()
|
||||
if err := i.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(i.ReplyToMsgID)
|
||||
if i.Flags.Has(0) {
|
||||
@@ -312,10 +332,10 @@ func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
if i.ReplyToPeerID == nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field reply_to_peer_id is nil")
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field reply_to_peer_id is nil")
|
||||
}
|
||||
if err := i.ReplyToPeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field reply_to_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field reply_to_peer_id: %w", err)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
@@ -325,10 +345,10 @@ func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(i.QuoteEntities))
|
||||
for idx, v := range i.QuoteEntities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field quote_entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field quote_entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field quote_entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field quote_entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,25 +357,28 @@ func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if i.Flags.Has(5) {
|
||||
if i.MonoforumPeerID == nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field monoforum_peer_id is nil")
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field monoforum_peer_id is nil")
|
||||
}
|
||||
if err := i.MonoforumPeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#869fbe10: field monoforum_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to encode inputReplyToMessage#3bd4b7c2: field monoforum_peer_id: %w", err)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(6) {
|
||||
b.PutInt(i.TodoItemID)
|
||||
}
|
||||
if i.Flags.Has(7) {
|
||||
b.PutBytes(i.PollOption)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputReplyToMessage) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputReplyToMessage#869fbe10 to nil")
|
||||
return fmt.Errorf("can't decode inputReplyToMessage#3bd4b7c2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputReplyToMessageTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
@@ -363,45 +386,45 @@ func (i *InputReplyToMessage) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputReplyToMessage) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputReplyToMessage#869fbe10 to nil")
|
||||
return fmt.Errorf("can't decode inputReplyToMessage#3bd4b7c2 to nil")
|
||||
}
|
||||
{
|
||||
if err := i.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field reply_to_msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field reply_to_msg_id: %w", err)
|
||||
}
|
||||
i.ReplyToMsgID = value
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field top_msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field top_msg_id: %w", err)
|
||||
}
|
||||
i.TopMsgID = value
|
||||
}
|
||||
if i.Flags.Has(1) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field reply_to_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field reply_to_peer_id: %w", err)
|
||||
}
|
||||
i.ReplyToPeerID = value
|
||||
}
|
||||
if i.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field quote_text: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field quote_text: %w", err)
|
||||
}
|
||||
i.QuoteText = value
|
||||
}
|
||||
if i.Flags.Has(3) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field quote_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field quote_entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -410,7 +433,7 @@ func (i *InputReplyToMessage) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field quote_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field quote_entities: %w", err)
|
||||
}
|
||||
i.QuoteEntities = append(i.QuoteEntities, value)
|
||||
}
|
||||
@@ -418,24 +441,31 @@ func (i *InputReplyToMessage) DecodeBare(b *bin.Buffer) error {
|
||||
if i.Flags.Has(4) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field quote_offset: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field quote_offset: %w", err)
|
||||
}
|
||||
i.QuoteOffset = value
|
||||
}
|
||||
if i.Flags.Has(5) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field monoforum_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field monoforum_peer_id: %w", err)
|
||||
}
|
||||
i.MonoforumPeerID = value
|
||||
}
|
||||
if i.Flags.Has(6) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#869fbe10: field todo_item_id: %w", err)
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field todo_item_id: %w", err)
|
||||
}
|
||||
i.TodoItemID = value
|
||||
}
|
||||
if i.Flags.Has(7) {
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputReplyToMessage#3bd4b7c2: field poll_option: %w", err)
|
||||
}
|
||||
i.PollOption = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -573,6 +603,24 @@ func (i *InputReplyToMessage) GetTodoItemID() (value int, ok bool) {
|
||||
return i.TodoItemID, true
|
||||
}
|
||||
|
||||
// SetPollOption sets value of PollOption conditional field.
|
||||
func (i *InputReplyToMessage) SetPollOption(value []byte) {
|
||||
i.Flags.Set(7)
|
||||
i.PollOption = value
|
||||
}
|
||||
|
||||
// GetPollOption returns value of PollOption conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputReplyToMessage) GetPollOption() (value []byte, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(7) {
|
||||
return value, false
|
||||
}
|
||||
return i.PollOption, true
|
||||
}
|
||||
|
||||
// MapQuoteEntities returns field QuoteEntities wrapped in MessageEntityClassArray helper.
|
||||
func (i *InputReplyToMessage) MapQuoteEntities() (value MessageEntityClassArray, ok bool) {
|
||||
if !i.Flags.Has(3) {
|
||||
@@ -905,7 +953,7 @@ const InputReplyToClassName = "InputReplyTo"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.InputReplyToMessage: // inputReplyToMessage#869fbe10
|
||||
// case *tg.InputReplyToMessage: // inputReplyToMessage#3bd4b7c2
|
||||
// case *tg.InputReplyToStory: // inputReplyToStory#5881323a
|
||||
// case *tg.InputReplyToMonoForum: // inputReplyToMonoForum#69d66c45
|
||||
// default: panic(v)
|
||||
@@ -937,7 +985,7 @@ func DecodeInputReplyTo(buf *bin.Buffer) (InputReplyToClass, error) {
|
||||
}
|
||||
switch id {
|
||||
case InputReplyToMessageTypeID:
|
||||
// Decoding inputReplyToMessage#869fbe10.
|
||||
// Decoding inputReplyToMessage#3bd4b7c2.
|
||||
v := InputReplyToMessage{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputReplyToClass: %w", err)
|
||||
|
||||
Generated
+436
@@ -14774,6 +14774,418 @@ func (m *MessageActionNoForwardsRequest) GetNewValue() (value bool) {
|
||||
return m.NewValue
|
||||
}
|
||||
|
||||
// MessageActionPollAppendAnswer represents TL type `messageActionPollAppendAnswer#9da1cd6c`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageActionPollAppendAnswer for reference.
|
||||
type MessageActionPollAppendAnswer struct {
|
||||
// Answer field of MessageActionPollAppendAnswer.
|
||||
Answer PollAnswerClass
|
||||
}
|
||||
|
||||
// MessageActionPollAppendAnswerTypeID is TL type id of MessageActionPollAppendAnswer.
|
||||
const MessageActionPollAppendAnswerTypeID = 0x9da1cd6c
|
||||
|
||||
// construct implements constructor of MessageActionClass.
|
||||
func (m MessageActionPollAppendAnswer) construct() MessageActionClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageActionPollAppendAnswer.
|
||||
var (
|
||||
_ bin.Encoder = &MessageActionPollAppendAnswer{}
|
||||
_ bin.Decoder = &MessageActionPollAppendAnswer{}
|
||||
_ bin.BareEncoder = &MessageActionPollAppendAnswer{}
|
||||
_ bin.BareDecoder = &MessageActionPollAppendAnswer{}
|
||||
|
||||
_ MessageActionClass = &MessageActionPollAppendAnswer{}
|
||||
)
|
||||
|
||||
func (m *MessageActionPollAppendAnswer) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Answer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageActionPollAppendAnswer) String() string {
|
||||
if m == nil {
|
||||
return "MessageActionPollAppendAnswer(nil)"
|
||||
}
|
||||
type Alias MessageActionPollAppendAnswer
|
||||
return fmt.Sprintf("MessageActionPollAppendAnswer%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageActionPollAppendAnswer from given interface.
|
||||
func (m *MessageActionPollAppendAnswer) FillFrom(from interface {
|
||||
GetAnswer() (value PollAnswerClass)
|
||||
}) {
|
||||
m.Answer = from.GetAnswer()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageActionPollAppendAnswer) TypeID() uint32 {
|
||||
return MessageActionPollAppendAnswerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageActionPollAppendAnswer) TypeName() string {
|
||||
return "messageActionPollAppendAnswer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageActionPollAppendAnswer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageActionPollAppendAnswer",
|
||||
ID: MessageActionPollAppendAnswerTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Answer",
|
||||
SchemaName: "answer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageActionPollAppendAnswer) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionPollAppendAnswer#9da1cd6c as nil")
|
||||
}
|
||||
b.PutID(MessageActionPollAppendAnswerTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageActionPollAppendAnswer) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionPollAppendAnswer#9da1cd6c as nil")
|
||||
}
|
||||
if m.Answer == nil {
|
||||
return fmt.Errorf("unable to encode messageActionPollAppendAnswer#9da1cd6c: field answer is nil")
|
||||
}
|
||||
if err := m.Answer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageActionPollAppendAnswer#9da1cd6c: field answer: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageActionPollAppendAnswer) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionPollAppendAnswer#9da1cd6c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageActionPollAppendAnswerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionPollAppendAnswer#9da1cd6c: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageActionPollAppendAnswer) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionPollAppendAnswer#9da1cd6c to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodePollAnswer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionPollAppendAnswer#9da1cd6c: field answer: %w", err)
|
||||
}
|
||||
m.Answer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAnswer returns value of Answer field.
|
||||
func (m *MessageActionPollAppendAnswer) GetAnswer() (value PollAnswerClass) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Answer
|
||||
}
|
||||
|
||||
// MessageActionPollDeleteAnswer represents TL type `messageActionPollDeleteAnswer#399674dc`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageActionPollDeleteAnswer for reference.
|
||||
type MessageActionPollDeleteAnswer struct {
|
||||
// Answer field of MessageActionPollDeleteAnswer.
|
||||
Answer PollAnswerClass
|
||||
}
|
||||
|
||||
// MessageActionPollDeleteAnswerTypeID is TL type id of MessageActionPollDeleteAnswer.
|
||||
const MessageActionPollDeleteAnswerTypeID = 0x399674dc
|
||||
|
||||
// construct implements constructor of MessageActionClass.
|
||||
func (m MessageActionPollDeleteAnswer) construct() MessageActionClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageActionPollDeleteAnswer.
|
||||
var (
|
||||
_ bin.Encoder = &MessageActionPollDeleteAnswer{}
|
||||
_ bin.Decoder = &MessageActionPollDeleteAnswer{}
|
||||
_ bin.BareEncoder = &MessageActionPollDeleteAnswer{}
|
||||
_ bin.BareDecoder = &MessageActionPollDeleteAnswer{}
|
||||
|
||||
_ MessageActionClass = &MessageActionPollDeleteAnswer{}
|
||||
)
|
||||
|
||||
func (m *MessageActionPollDeleteAnswer) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Answer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageActionPollDeleteAnswer) String() string {
|
||||
if m == nil {
|
||||
return "MessageActionPollDeleteAnswer(nil)"
|
||||
}
|
||||
type Alias MessageActionPollDeleteAnswer
|
||||
return fmt.Sprintf("MessageActionPollDeleteAnswer%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageActionPollDeleteAnswer from given interface.
|
||||
func (m *MessageActionPollDeleteAnswer) FillFrom(from interface {
|
||||
GetAnswer() (value PollAnswerClass)
|
||||
}) {
|
||||
m.Answer = from.GetAnswer()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageActionPollDeleteAnswer) TypeID() uint32 {
|
||||
return MessageActionPollDeleteAnswerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageActionPollDeleteAnswer) TypeName() string {
|
||||
return "messageActionPollDeleteAnswer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageActionPollDeleteAnswer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageActionPollDeleteAnswer",
|
||||
ID: MessageActionPollDeleteAnswerTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Answer",
|
||||
SchemaName: "answer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageActionPollDeleteAnswer) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionPollDeleteAnswer#399674dc as nil")
|
||||
}
|
||||
b.PutID(MessageActionPollDeleteAnswerTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageActionPollDeleteAnswer) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionPollDeleteAnswer#399674dc as nil")
|
||||
}
|
||||
if m.Answer == nil {
|
||||
return fmt.Errorf("unable to encode messageActionPollDeleteAnswer#399674dc: field answer is nil")
|
||||
}
|
||||
if err := m.Answer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageActionPollDeleteAnswer#399674dc: field answer: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageActionPollDeleteAnswer) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionPollDeleteAnswer#399674dc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageActionPollDeleteAnswerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionPollDeleteAnswer#399674dc: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageActionPollDeleteAnswer) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionPollDeleteAnswer#399674dc to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodePollAnswer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionPollDeleteAnswer#399674dc: field answer: %w", err)
|
||||
}
|
||||
m.Answer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAnswer returns value of Answer field.
|
||||
func (m *MessageActionPollDeleteAnswer) GetAnswer() (value PollAnswerClass) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Answer
|
||||
}
|
||||
|
||||
// MessageActionManagedBotCreated represents TL type `messageActionManagedBotCreated#16605e3e`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageActionManagedBotCreated for reference.
|
||||
type MessageActionManagedBotCreated struct {
|
||||
// BotID field of MessageActionManagedBotCreated.
|
||||
BotID int64
|
||||
}
|
||||
|
||||
// MessageActionManagedBotCreatedTypeID is TL type id of MessageActionManagedBotCreated.
|
||||
const MessageActionManagedBotCreatedTypeID = 0x16605e3e
|
||||
|
||||
// construct implements constructor of MessageActionClass.
|
||||
func (m MessageActionManagedBotCreated) construct() MessageActionClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageActionManagedBotCreated.
|
||||
var (
|
||||
_ bin.Encoder = &MessageActionManagedBotCreated{}
|
||||
_ bin.Decoder = &MessageActionManagedBotCreated{}
|
||||
_ bin.BareEncoder = &MessageActionManagedBotCreated{}
|
||||
_ bin.BareDecoder = &MessageActionManagedBotCreated{}
|
||||
|
||||
_ MessageActionClass = &MessageActionManagedBotCreated{}
|
||||
)
|
||||
|
||||
func (m *MessageActionManagedBotCreated) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.BotID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageActionManagedBotCreated) String() string {
|
||||
if m == nil {
|
||||
return "MessageActionManagedBotCreated(nil)"
|
||||
}
|
||||
type Alias MessageActionManagedBotCreated
|
||||
return fmt.Sprintf("MessageActionManagedBotCreated%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageActionManagedBotCreated from given interface.
|
||||
func (m *MessageActionManagedBotCreated) FillFrom(from interface {
|
||||
GetBotID() (value int64)
|
||||
}) {
|
||||
m.BotID = from.GetBotID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageActionManagedBotCreated) TypeID() uint32 {
|
||||
return MessageActionManagedBotCreatedTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageActionManagedBotCreated) TypeName() string {
|
||||
return "messageActionManagedBotCreated"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageActionManagedBotCreated) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageActionManagedBotCreated",
|
||||
ID: MessageActionManagedBotCreatedTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotID",
|
||||
SchemaName: "bot_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageActionManagedBotCreated) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionManagedBotCreated#16605e3e as nil")
|
||||
}
|
||||
b.PutID(MessageActionManagedBotCreatedTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageActionManagedBotCreated) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageActionManagedBotCreated#16605e3e as nil")
|
||||
}
|
||||
b.PutLong(m.BotID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageActionManagedBotCreated) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionManagedBotCreated#16605e3e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageActionManagedBotCreatedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionManagedBotCreated#16605e3e: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageActionManagedBotCreated) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageActionManagedBotCreated#16605e3e to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageActionManagedBotCreated#16605e3e: field bot_id: %w", err)
|
||||
}
|
||||
m.BotID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBotID returns value of BotID field.
|
||||
func (m *MessageActionManagedBotCreated) GetBotID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.BotID
|
||||
}
|
||||
|
||||
// MessageActionClassName is schema name of MessageActionClass.
|
||||
const MessageActionClassName = "MessageAction"
|
||||
|
||||
@@ -14852,6 +15264,9 @@ const MessageActionClassName = "MessageAction"
|
||||
// case *tg.MessageActionChangeCreator: // messageActionChangeCreator#e188503b
|
||||
// case *tg.MessageActionNoForwardsToggle: // messageActionNoForwardsToggle#bf7d6572
|
||||
// case *tg.MessageActionNoForwardsRequest: // messageActionNoForwardsRequest#3e2793ba
|
||||
// case *tg.MessageActionPollAppendAnswer: // messageActionPollAppendAnswer#9da1cd6c
|
||||
// case *tg.MessageActionPollDeleteAnswer: // messageActionPollDeleteAnswer#399674dc
|
||||
// case *tg.MessageActionManagedBotCreated: // messageActionManagedBotCreated#16605e3e
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MessageActionClass interface {
|
||||
@@ -15328,6 +15743,27 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageActionPollAppendAnswerTypeID:
|
||||
// Decoding messageActionPollAppendAnswer#9da1cd6c.
|
||||
v := MessageActionPollAppendAnswer{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageActionPollDeleteAnswerTypeID:
|
||||
// Decoding messageActionPollDeleteAnswer#399674dc.
|
||||
v := MessageActionPollDeleteAnswer{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageActionManagedBotCreatedTypeID:
|
||||
// Decoding messageActionManagedBotCreated#16605e3e.
|
||||
v := MessageActionManagedBotCreated{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
+285
@@ -857,6 +857,45 @@ func (s MessageActionClassArray) AsMessageActionNoForwardsRequest() (to MessageA
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionPollAppendAnswer returns copy with only MessageActionPollAppendAnswer constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionPollAppendAnswer() (to MessageActionPollAppendAnswerArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionPollAppendAnswer)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionPollDeleteAnswer returns copy with only MessageActionPollDeleteAnswer constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionPollDeleteAnswer() (to MessageActionPollDeleteAnswerArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionPollDeleteAnswer)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionManagedBotCreated returns copy with only MessageActionManagedBotCreated constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionManagedBotCreated() (to MessageActionManagedBotCreatedArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionManagedBotCreated)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate.
|
||||
type MessageActionChatCreateArray []MessageActionChatCreate
|
||||
|
||||
@@ -5530,3 +5569,249 @@ func (s *MessageActionNoForwardsRequestArray) Pop() (v MessageActionNoForwardsRe
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageActionPollAppendAnswerArray is adapter for slice of MessageActionPollAppendAnswer.
|
||||
type MessageActionPollAppendAnswerArray []MessageActionPollAppendAnswer
|
||||
|
||||
// Sort sorts slice of MessageActionPollAppendAnswer.
|
||||
func (s MessageActionPollAppendAnswerArray) Sort(less func(a, b MessageActionPollAppendAnswer) bool) MessageActionPollAppendAnswerArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionPollAppendAnswer.
|
||||
func (s MessageActionPollAppendAnswerArray) SortStable(less func(a, b MessageActionPollAppendAnswer) bool) MessageActionPollAppendAnswerArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionPollAppendAnswer.
|
||||
func (s MessageActionPollAppendAnswerArray) Retain(keep func(x MessageActionPollAppendAnswer) bool) MessageActionPollAppendAnswerArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageActionPollAppendAnswerArray) First() (v MessageActionPollAppendAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionPollAppendAnswerArray) Last() (v MessageActionPollAppendAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionPollAppendAnswerArray) PopFirst() (v MessageActionPollAppendAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageActionPollAppendAnswer
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionPollAppendAnswerArray) Pop() (v MessageActionPollAppendAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageActionPollDeleteAnswerArray is adapter for slice of MessageActionPollDeleteAnswer.
|
||||
type MessageActionPollDeleteAnswerArray []MessageActionPollDeleteAnswer
|
||||
|
||||
// Sort sorts slice of MessageActionPollDeleteAnswer.
|
||||
func (s MessageActionPollDeleteAnswerArray) Sort(less func(a, b MessageActionPollDeleteAnswer) bool) MessageActionPollDeleteAnswerArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionPollDeleteAnswer.
|
||||
func (s MessageActionPollDeleteAnswerArray) SortStable(less func(a, b MessageActionPollDeleteAnswer) bool) MessageActionPollDeleteAnswerArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionPollDeleteAnswer.
|
||||
func (s MessageActionPollDeleteAnswerArray) Retain(keep func(x MessageActionPollDeleteAnswer) bool) MessageActionPollDeleteAnswerArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageActionPollDeleteAnswerArray) First() (v MessageActionPollDeleteAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionPollDeleteAnswerArray) Last() (v MessageActionPollDeleteAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionPollDeleteAnswerArray) PopFirst() (v MessageActionPollDeleteAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageActionPollDeleteAnswer
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionPollDeleteAnswerArray) Pop() (v MessageActionPollDeleteAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageActionManagedBotCreatedArray is adapter for slice of MessageActionManagedBotCreated.
|
||||
type MessageActionManagedBotCreatedArray []MessageActionManagedBotCreated
|
||||
|
||||
// Sort sorts slice of MessageActionManagedBotCreated.
|
||||
func (s MessageActionManagedBotCreatedArray) Sort(less func(a, b MessageActionManagedBotCreated) bool) MessageActionManagedBotCreatedArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionManagedBotCreated.
|
||||
func (s MessageActionManagedBotCreatedArray) SortStable(less func(a, b MessageActionManagedBotCreated) bool) MessageActionManagedBotCreatedArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionManagedBotCreated.
|
||||
func (s MessageActionManagedBotCreatedArray) Retain(keep func(x MessageActionManagedBotCreated) bool) MessageActionManagedBotCreatedArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageActionManagedBotCreatedArray) First() (v MessageActionManagedBotCreated, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionManagedBotCreatedArray) Last() (v MessageActionManagedBotCreated, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionManagedBotCreatedArray) PopFirst() (v MessageActionManagedBotCreated, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageActionManagedBotCreated
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageActionManagedBotCreatedArray) Pop() (v MessageActionManagedBotCreated, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
Generated
+534
@@ -4217,6 +4217,516 @@ func (m *MessageEntityFormattedDate) GetDate() (value int) {
|
||||
return m.Date
|
||||
}
|
||||
|
||||
// MessageEntityDiffInsert represents TL type `messageEntityDiffInsert#71777116`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffInsert for reference.
|
||||
type MessageEntityDiffInsert struct {
|
||||
// Offset field of MessageEntityDiffInsert.
|
||||
Offset int
|
||||
// Length field of MessageEntityDiffInsert.
|
||||
Length int
|
||||
}
|
||||
|
||||
// MessageEntityDiffInsertTypeID is TL type id of MessageEntityDiffInsert.
|
||||
const MessageEntityDiffInsertTypeID = 0x71777116
|
||||
|
||||
// construct implements constructor of MessageEntityClass.
|
||||
func (m MessageEntityDiffInsert) construct() MessageEntityClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageEntityDiffInsert.
|
||||
var (
|
||||
_ bin.Encoder = &MessageEntityDiffInsert{}
|
||||
_ bin.Decoder = &MessageEntityDiffInsert{}
|
||||
_ bin.BareEncoder = &MessageEntityDiffInsert{}
|
||||
_ bin.BareDecoder = &MessageEntityDiffInsert{}
|
||||
|
||||
_ MessageEntityClass = &MessageEntityDiffInsert{}
|
||||
)
|
||||
|
||||
func (m *MessageEntityDiffInsert) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Offset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Length == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageEntityDiffInsert) String() string {
|
||||
if m == nil {
|
||||
return "MessageEntityDiffInsert(nil)"
|
||||
}
|
||||
type Alias MessageEntityDiffInsert
|
||||
return fmt.Sprintf("MessageEntityDiffInsert%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageEntityDiffInsert from given interface.
|
||||
func (m *MessageEntityDiffInsert) FillFrom(from interface {
|
||||
GetOffset() (value int)
|
||||
GetLength() (value int)
|
||||
}) {
|
||||
m.Offset = from.GetOffset()
|
||||
m.Length = from.GetLength()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageEntityDiffInsert) TypeID() uint32 {
|
||||
return MessageEntityDiffInsertTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageEntityDiffInsert) TypeName() string {
|
||||
return "messageEntityDiffInsert"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageEntityDiffInsert) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageEntityDiffInsert",
|
||||
ID: MessageEntityDiffInsertTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
{
|
||||
Name: "Length",
|
||||
SchemaName: "length",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageEntityDiffInsert) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffInsert#71777116 as nil")
|
||||
}
|
||||
b.PutID(MessageEntityDiffInsertTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageEntityDiffInsert) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffInsert#71777116 as nil")
|
||||
}
|
||||
b.PutInt(m.Offset)
|
||||
b.PutInt(m.Length)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageEntityDiffInsert) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffInsert#71777116 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageEntityDiffInsertTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffInsert#71777116: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageEntityDiffInsert) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffInsert#71777116 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffInsert#71777116: field offset: %w", err)
|
||||
}
|
||||
m.Offset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffInsert#71777116: field length: %w", err)
|
||||
}
|
||||
m.Length = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (m *MessageEntityDiffInsert) GetOffset() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Offset
|
||||
}
|
||||
|
||||
// GetLength returns value of Length field.
|
||||
func (m *MessageEntityDiffInsert) GetLength() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Length
|
||||
}
|
||||
|
||||
// MessageEntityDiffReplace represents TL type `messageEntityDiffReplace#c6c1e5a7`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffReplace for reference.
|
||||
type MessageEntityDiffReplace struct {
|
||||
// Offset field of MessageEntityDiffReplace.
|
||||
Offset int
|
||||
// Length field of MessageEntityDiffReplace.
|
||||
Length int
|
||||
// OldText field of MessageEntityDiffReplace.
|
||||
OldText string
|
||||
}
|
||||
|
||||
// MessageEntityDiffReplaceTypeID is TL type id of MessageEntityDiffReplace.
|
||||
const MessageEntityDiffReplaceTypeID = 0xc6c1e5a7
|
||||
|
||||
// construct implements constructor of MessageEntityClass.
|
||||
func (m MessageEntityDiffReplace) construct() MessageEntityClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageEntityDiffReplace.
|
||||
var (
|
||||
_ bin.Encoder = &MessageEntityDiffReplace{}
|
||||
_ bin.Decoder = &MessageEntityDiffReplace{}
|
||||
_ bin.BareEncoder = &MessageEntityDiffReplace{}
|
||||
_ bin.BareDecoder = &MessageEntityDiffReplace{}
|
||||
|
||||
_ MessageEntityClass = &MessageEntityDiffReplace{}
|
||||
)
|
||||
|
||||
func (m *MessageEntityDiffReplace) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Offset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Length == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.OldText == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageEntityDiffReplace) String() string {
|
||||
if m == nil {
|
||||
return "MessageEntityDiffReplace(nil)"
|
||||
}
|
||||
type Alias MessageEntityDiffReplace
|
||||
return fmt.Sprintf("MessageEntityDiffReplace%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageEntityDiffReplace from given interface.
|
||||
func (m *MessageEntityDiffReplace) FillFrom(from interface {
|
||||
GetOffset() (value int)
|
||||
GetLength() (value int)
|
||||
GetOldText() (value string)
|
||||
}) {
|
||||
m.Offset = from.GetOffset()
|
||||
m.Length = from.GetLength()
|
||||
m.OldText = from.GetOldText()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageEntityDiffReplace) TypeID() uint32 {
|
||||
return MessageEntityDiffReplaceTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageEntityDiffReplace) TypeName() string {
|
||||
return "messageEntityDiffReplace"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageEntityDiffReplace) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageEntityDiffReplace",
|
||||
ID: MessageEntityDiffReplaceTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
{
|
||||
Name: "Length",
|
||||
SchemaName: "length",
|
||||
},
|
||||
{
|
||||
Name: "OldText",
|
||||
SchemaName: "old_text",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageEntityDiffReplace) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffReplace#c6c1e5a7 as nil")
|
||||
}
|
||||
b.PutID(MessageEntityDiffReplaceTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageEntityDiffReplace) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffReplace#c6c1e5a7 as nil")
|
||||
}
|
||||
b.PutInt(m.Offset)
|
||||
b.PutInt(m.Length)
|
||||
b.PutString(m.OldText)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageEntityDiffReplace) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffReplace#c6c1e5a7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageEntityDiffReplaceTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffReplace#c6c1e5a7: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageEntityDiffReplace) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffReplace#c6c1e5a7 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffReplace#c6c1e5a7: field offset: %w", err)
|
||||
}
|
||||
m.Offset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffReplace#c6c1e5a7: field length: %w", err)
|
||||
}
|
||||
m.Length = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffReplace#c6c1e5a7: field old_text: %w", err)
|
||||
}
|
||||
m.OldText = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (m *MessageEntityDiffReplace) GetOffset() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Offset
|
||||
}
|
||||
|
||||
// GetLength returns value of Length field.
|
||||
func (m *MessageEntityDiffReplace) GetLength() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Length
|
||||
}
|
||||
|
||||
// GetOldText returns value of OldText field.
|
||||
func (m *MessageEntityDiffReplace) GetOldText() (value string) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.OldText
|
||||
}
|
||||
|
||||
// MessageEntityDiffDelete represents TL type `messageEntityDiffDelete#652c1c5`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityDiffDelete for reference.
|
||||
type MessageEntityDiffDelete struct {
|
||||
// Offset field of MessageEntityDiffDelete.
|
||||
Offset int
|
||||
// Length field of MessageEntityDiffDelete.
|
||||
Length int
|
||||
}
|
||||
|
||||
// MessageEntityDiffDeleteTypeID is TL type id of MessageEntityDiffDelete.
|
||||
const MessageEntityDiffDeleteTypeID = 0x652c1c5
|
||||
|
||||
// construct implements constructor of MessageEntityClass.
|
||||
func (m MessageEntityDiffDelete) construct() MessageEntityClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageEntityDiffDelete.
|
||||
var (
|
||||
_ bin.Encoder = &MessageEntityDiffDelete{}
|
||||
_ bin.Decoder = &MessageEntityDiffDelete{}
|
||||
_ bin.BareEncoder = &MessageEntityDiffDelete{}
|
||||
_ bin.BareDecoder = &MessageEntityDiffDelete{}
|
||||
|
||||
_ MessageEntityClass = &MessageEntityDiffDelete{}
|
||||
)
|
||||
|
||||
func (m *MessageEntityDiffDelete) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Offset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Length == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageEntityDiffDelete) String() string {
|
||||
if m == nil {
|
||||
return "MessageEntityDiffDelete(nil)"
|
||||
}
|
||||
type Alias MessageEntityDiffDelete
|
||||
return fmt.Sprintf("MessageEntityDiffDelete%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageEntityDiffDelete from given interface.
|
||||
func (m *MessageEntityDiffDelete) FillFrom(from interface {
|
||||
GetOffset() (value int)
|
||||
GetLength() (value int)
|
||||
}) {
|
||||
m.Offset = from.GetOffset()
|
||||
m.Length = from.GetLength()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageEntityDiffDelete) TypeID() uint32 {
|
||||
return MessageEntityDiffDeleteTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageEntityDiffDelete) TypeName() string {
|
||||
return "messageEntityDiffDelete"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageEntityDiffDelete) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageEntityDiffDelete",
|
||||
ID: MessageEntityDiffDeleteTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
{
|
||||
Name: "Length",
|
||||
SchemaName: "length",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageEntityDiffDelete) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffDelete#652c1c5 as nil")
|
||||
}
|
||||
b.PutID(MessageEntityDiffDeleteTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageEntityDiffDelete) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityDiffDelete#652c1c5 as nil")
|
||||
}
|
||||
b.PutInt(m.Offset)
|
||||
b.PutInt(m.Length)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageEntityDiffDelete) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffDelete#652c1c5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageEntityDiffDeleteTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffDelete#652c1c5: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageEntityDiffDelete) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityDiffDelete#652c1c5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffDelete#652c1c5: field offset: %w", err)
|
||||
}
|
||||
m.Offset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityDiffDelete#652c1c5: field length: %w", err)
|
||||
}
|
||||
m.Length = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (m *MessageEntityDiffDelete) GetOffset() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Offset
|
||||
}
|
||||
|
||||
// GetLength returns value of Length field.
|
||||
func (m *MessageEntityDiffDelete) GetLength() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Length
|
||||
}
|
||||
|
||||
// MessageEntityClassName is schema name of MessageEntityClass.
|
||||
const MessageEntityClassName = "MessageEntity"
|
||||
|
||||
@@ -4253,6 +4763,9 @@ const MessageEntityClassName = "MessageEntity"
|
||||
// case *tg.MessageEntityCustomEmoji: // messageEntityCustomEmoji#c8cf05f8
|
||||
// case *tg.MessageEntityBlockquote: // messageEntityBlockquote#f1ccaaac
|
||||
// case *tg.MessageEntityFormattedDate: // messageEntityFormattedDate#904ac7c7
|
||||
// case *tg.MessageEntityDiffInsert: // messageEntityDiffInsert#71777116
|
||||
// case *tg.MessageEntityDiffReplace: // messageEntityDiffReplace#c6c1e5a7
|
||||
// case *tg.MessageEntityDiffDelete: // messageEntityDiffDelete#652c1c5
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MessageEntityClass interface {
|
||||
@@ -4447,6 +4960,27 @@ func DecodeMessageEntity(buf *bin.Buffer) (MessageEntityClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageEntityDiffInsertTypeID:
|
||||
// Decoding messageEntityDiffInsert#71777116.
|
||||
v := MessageEntityDiffInsert{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageEntityDiffReplaceTypeID:
|
||||
// Decoding messageEntityDiffReplace#c6c1e5a7.
|
||||
v := MessageEntityDiffReplace{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageEntityDiffDeleteTypeID:
|
||||
// Decoding messageEntityDiffDelete#652c1c5.
|
||||
v := MessageEntityDiffDelete{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
+285
@@ -402,6 +402,45 @@ func (s MessageEntityClassArray) AsMessageEntityFormattedDate() (to MessageEntit
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageEntityDiffInsert returns copy with only MessageEntityDiffInsert constructors.
|
||||
func (s MessageEntityClassArray) AsMessageEntityDiffInsert() (to MessageEntityDiffInsertArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageEntityDiffInsert)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageEntityDiffReplace returns copy with only MessageEntityDiffReplace constructors.
|
||||
func (s MessageEntityClassArray) AsMessageEntityDiffReplace() (to MessageEntityDiffReplaceArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageEntityDiffReplace)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageEntityDiffDelete returns copy with only MessageEntityDiffDelete constructors.
|
||||
func (s MessageEntityClassArray) AsMessageEntityDiffDelete() (to MessageEntityDiffDeleteArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageEntityDiffDelete)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// MessageEntityUnknownArray is adapter for slice of MessageEntityUnknown.
|
||||
type MessageEntityUnknownArray []MessageEntityUnknown
|
||||
|
||||
@@ -2219,3 +2258,249 @@ func (s MessageEntityFormattedDateArray) SortStableByDate() MessageEntityFormatt
|
||||
return a.GetDate() < b.GetDate()
|
||||
})
|
||||
}
|
||||
|
||||
// MessageEntityDiffInsertArray is adapter for slice of MessageEntityDiffInsert.
|
||||
type MessageEntityDiffInsertArray []MessageEntityDiffInsert
|
||||
|
||||
// Sort sorts slice of MessageEntityDiffInsert.
|
||||
func (s MessageEntityDiffInsertArray) Sort(less func(a, b MessageEntityDiffInsert) bool) MessageEntityDiffInsertArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageEntityDiffInsert.
|
||||
func (s MessageEntityDiffInsertArray) SortStable(less func(a, b MessageEntityDiffInsert) bool) MessageEntityDiffInsertArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageEntityDiffInsert.
|
||||
func (s MessageEntityDiffInsertArray) Retain(keep func(x MessageEntityDiffInsert) bool) MessageEntityDiffInsertArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageEntityDiffInsertArray) First() (v MessageEntityDiffInsert, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageEntityDiffInsertArray) Last() (v MessageEntityDiffInsert, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffInsertArray) PopFirst() (v MessageEntityDiffInsert, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageEntityDiffInsert
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffInsertArray) Pop() (v MessageEntityDiffInsert, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageEntityDiffReplaceArray is adapter for slice of MessageEntityDiffReplace.
|
||||
type MessageEntityDiffReplaceArray []MessageEntityDiffReplace
|
||||
|
||||
// Sort sorts slice of MessageEntityDiffReplace.
|
||||
func (s MessageEntityDiffReplaceArray) Sort(less func(a, b MessageEntityDiffReplace) bool) MessageEntityDiffReplaceArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageEntityDiffReplace.
|
||||
func (s MessageEntityDiffReplaceArray) SortStable(less func(a, b MessageEntityDiffReplace) bool) MessageEntityDiffReplaceArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageEntityDiffReplace.
|
||||
func (s MessageEntityDiffReplaceArray) Retain(keep func(x MessageEntityDiffReplace) bool) MessageEntityDiffReplaceArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageEntityDiffReplaceArray) First() (v MessageEntityDiffReplace, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageEntityDiffReplaceArray) Last() (v MessageEntityDiffReplace, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffReplaceArray) PopFirst() (v MessageEntityDiffReplace, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageEntityDiffReplace
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffReplaceArray) Pop() (v MessageEntityDiffReplace, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageEntityDiffDeleteArray is adapter for slice of MessageEntityDiffDelete.
|
||||
type MessageEntityDiffDeleteArray []MessageEntityDiffDelete
|
||||
|
||||
// Sort sorts slice of MessageEntityDiffDelete.
|
||||
func (s MessageEntityDiffDeleteArray) Sort(less func(a, b MessageEntityDiffDelete) bool) MessageEntityDiffDeleteArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageEntityDiffDelete.
|
||||
func (s MessageEntityDiffDeleteArray) SortStable(less func(a, b MessageEntityDiffDelete) bool) MessageEntityDiffDeleteArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageEntityDiffDelete.
|
||||
func (s MessageEntityDiffDeleteArray) Retain(keep func(x MessageEntityDiffDelete) bool) MessageEntityDiffDeleteArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s MessageEntityDiffDeleteArray) First() (v MessageEntityDiffDelete, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageEntityDiffDeleteArray) Last() (v MessageEntityDiffDelete, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffDeleteArray) PopFirst() (v MessageEntityDiffDelete, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero MessageEntityDiffDelete
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *MessageEntityDiffDeleteArray) Pop() (v MessageEntityDiffDelete, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
Generated
+187
-28
@@ -133,7 +133,7 @@ func (m *MessageMediaEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MessageMediaPhoto represents TL type `messageMediaPhoto#695150d7`.
|
||||
// MessageMediaPhoto represents TL type `messageMediaPhoto#e216eb63`.
|
||||
// Attached photo.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageMediaPhoto for reference.
|
||||
@@ -145,6 +145,8 @@ type MessageMediaPhoto struct {
|
||||
Flags bin.Fields
|
||||
// Whether this media should be hidden behind a spoiler warning
|
||||
Spoiler bool
|
||||
// LivePhoto field of MessageMediaPhoto.
|
||||
LivePhoto bool
|
||||
// Photo
|
||||
//
|
||||
// Use SetPhoto and GetPhoto helpers.
|
||||
@@ -153,10 +155,14 @@ type MessageMediaPhoto struct {
|
||||
//
|
||||
// Use SetTTLSeconds and GetTTLSeconds helpers.
|
||||
TTLSeconds int
|
||||
// Video field of MessageMediaPhoto.
|
||||
//
|
||||
// Use SetVideo and GetVideo helpers.
|
||||
Video DocumentClass
|
||||
}
|
||||
|
||||
// MessageMediaPhotoTypeID is TL type id of MessageMediaPhoto.
|
||||
const MessageMediaPhotoTypeID = 0x695150d7
|
||||
const MessageMediaPhotoTypeID = 0xe216eb63
|
||||
|
||||
// construct implements constructor of MessageMediaClass.
|
||||
func (m MessageMediaPhoto) construct() MessageMediaClass { return &m }
|
||||
@@ -181,12 +187,18 @@ func (m *MessageMediaPhoto) Zero() bool {
|
||||
if !(m.Spoiler == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.LivePhoto == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.Photo == nil) {
|
||||
return false
|
||||
}
|
||||
if !(m.TTLSeconds == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Video == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -203,10 +215,13 @@ func (m *MessageMediaPhoto) String() string {
|
||||
// FillFrom fills MessageMediaPhoto from given interface.
|
||||
func (m *MessageMediaPhoto) FillFrom(from interface {
|
||||
GetSpoiler() (value bool)
|
||||
GetLivePhoto() (value bool)
|
||||
GetPhoto() (value PhotoClass, ok bool)
|
||||
GetTTLSeconds() (value int, ok bool)
|
||||
GetVideo() (value DocumentClass, ok bool)
|
||||
}) {
|
||||
m.Spoiler = from.GetSpoiler()
|
||||
m.LivePhoto = from.GetLivePhoto()
|
||||
if val, ok := from.GetPhoto(); ok {
|
||||
m.Photo = val
|
||||
}
|
||||
@@ -215,6 +230,10 @@ func (m *MessageMediaPhoto) FillFrom(from interface {
|
||||
m.TTLSeconds = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetVideo(); ok {
|
||||
m.Video = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -245,6 +264,11 @@ func (m *MessageMediaPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "spoiler",
|
||||
Null: !m.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "LivePhoto",
|
||||
SchemaName: "live_photo",
|
||||
Null: !m.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "Photo",
|
||||
SchemaName: "photo",
|
||||
@@ -255,6 +279,11 @@ func (m *MessageMediaPhoto) TypeInfo() tdp.Type {
|
||||
SchemaName: "ttl_seconds",
|
||||
Null: !m.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "Video",
|
||||
SchemaName: "video",
|
||||
Null: !m.Flags.Has(4),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -264,18 +293,24 @@ func (m *MessageMediaPhoto) SetFlags() {
|
||||
if !(m.Spoiler == false) {
|
||||
m.Flags.Set(3)
|
||||
}
|
||||
if !(m.LivePhoto == false) {
|
||||
m.Flags.Set(4)
|
||||
}
|
||||
if !(m.Photo == nil) {
|
||||
m.Flags.Set(0)
|
||||
}
|
||||
if !(m.TTLSeconds == 0) {
|
||||
m.Flags.Set(2)
|
||||
}
|
||||
if !(m.Video == nil) {
|
||||
m.Flags.Set(4)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageMediaPhoto) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaPhoto#695150d7 as nil")
|
||||
return fmt.Errorf("can't encode messageMediaPhoto#e216eb63 as nil")
|
||||
}
|
||||
b.PutID(MessageMediaPhotoTypeID)
|
||||
return m.EncodeBare(b)
|
||||
@@ -284,33 +319,41 @@ func (m *MessageMediaPhoto) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageMediaPhoto) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaPhoto#695150d7 as nil")
|
||||
return fmt.Errorf("can't encode messageMediaPhoto#e216eb63 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#e216eb63: field flags: %w", err)
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
if m.Photo == nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field photo is nil")
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#e216eb63: field photo is nil")
|
||||
}
|
||||
if err := m.Photo.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field photo: %w", err)
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#e216eb63: field photo: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(2) {
|
||||
b.PutInt(m.TTLSeconds)
|
||||
}
|
||||
if m.Flags.Has(4) {
|
||||
if m.Video == nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#e216eb63: field video is nil")
|
||||
}
|
||||
if err := m.Video.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPhoto#e216eb63: field video: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageMediaPhoto) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaPhoto#695150d7 to nil")
|
||||
return fmt.Errorf("can't decode messageMediaPhoto#e216eb63 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageMediaPhotoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#e216eb63: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
@@ -318,28 +361,36 @@ func (m *MessageMediaPhoto) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageMediaPhoto) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaPhoto#695150d7 to nil")
|
||||
return fmt.Errorf("can't decode messageMediaPhoto#e216eb63 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#e216eb63: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
m.Spoiler = m.Flags.Has(3)
|
||||
m.LivePhoto = m.Flags.Has(4)
|
||||
if m.Flags.Has(0) {
|
||||
value, err := DecodePhoto(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field photo: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#e216eb63: field photo: %w", err)
|
||||
}
|
||||
m.Photo = value
|
||||
}
|
||||
if m.Flags.Has(2) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field ttl_seconds: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#e216eb63: field ttl_seconds: %w", err)
|
||||
}
|
||||
m.TTLSeconds = value
|
||||
}
|
||||
if m.Flags.Has(4) {
|
||||
value, err := DecodeDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPhoto#e216eb63: field video: %w", err)
|
||||
}
|
||||
m.Video = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -362,6 +413,25 @@ func (m *MessageMediaPhoto) GetSpoiler() (value bool) {
|
||||
return m.Flags.Has(3)
|
||||
}
|
||||
|
||||
// SetLivePhoto sets value of LivePhoto conditional field.
|
||||
func (m *MessageMediaPhoto) SetLivePhoto(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(4)
|
||||
m.LivePhoto = true
|
||||
} else {
|
||||
m.Flags.Unset(4)
|
||||
m.LivePhoto = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetLivePhoto returns value of LivePhoto conditional field.
|
||||
func (m *MessageMediaPhoto) GetLivePhoto() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(4)
|
||||
}
|
||||
|
||||
// SetPhoto sets value of Photo conditional field.
|
||||
func (m *MessageMediaPhoto) SetPhoto(value PhotoClass) {
|
||||
m.Flags.Set(0)
|
||||
@@ -398,6 +468,24 @@ func (m *MessageMediaPhoto) GetTTLSeconds() (value int, ok bool) {
|
||||
return m.TTLSeconds, true
|
||||
}
|
||||
|
||||
// SetVideo sets value of Video conditional field.
|
||||
func (m *MessageMediaPhoto) SetVideo(value DocumentClass) {
|
||||
m.Flags.Set(4)
|
||||
m.Video = value
|
||||
}
|
||||
|
||||
// GetVideo returns value of Video conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *MessageMediaPhoto) GetVideo() (value DocumentClass, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags.Has(4) {
|
||||
return value, false
|
||||
}
|
||||
return m.Video, true
|
||||
}
|
||||
|
||||
// MessageMediaGeo represents TL type `messageMediaGeo#56e0d474`.
|
||||
// Attached map.
|
||||
//
|
||||
@@ -2981,19 +3069,25 @@ func (m *MessageMediaGeoLive) GetProximityNotificationRadius() (value int, ok bo
|
||||
return m.ProximityNotificationRadius, true
|
||||
}
|
||||
|
||||
// MessageMediaPoll represents TL type `messageMediaPoll#4bd6e798`.
|
||||
// MessageMediaPoll represents TL type `messageMediaPoll#773f4e66`.
|
||||
// Poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageMediaPoll for reference.
|
||||
type MessageMediaPoll struct {
|
||||
// Flags field of MessageMediaPoll.
|
||||
Flags bin.Fields
|
||||
// The poll
|
||||
Poll Poll
|
||||
// The results of the poll
|
||||
Results PollResults
|
||||
// AttachedMedia field of MessageMediaPoll.
|
||||
//
|
||||
// Use SetAttachedMedia and GetAttachedMedia helpers.
|
||||
AttachedMedia MessageMediaClass
|
||||
}
|
||||
|
||||
// MessageMediaPollTypeID is TL type id of MessageMediaPoll.
|
||||
const MessageMediaPollTypeID = 0x4bd6e798
|
||||
const MessageMediaPollTypeID = 0x773f4e66
|
||||
|
||||
// construct implements constructor of MessageMediaClass.
|
||||
func (m MessageMediaPoll) construct() MessageMediaClass { return &m }
|
||||
@@ -3012,12 +3106,18 @@ func (m *MessageMediaPoll) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(m.Poll.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(m.Results.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(m.AttachedMedia == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -3035,9 +3135,14 @@ func (m *MessageMediaPoll) String() string {
|
||||
func (m *MessageMediaPoll) FillFrom(from interface {
|
||||
GetPoll() (value Poll)
|
||||
GetResults() (value PollResults)
|
||||
GetAttachedMedia() (value MessageMediaClass, ok bool)
|
||||
}) {
|
||||
m.Poll = from.GetPoll()
|
||||
m.Results = from.GetResults()
|
||||
if val, ok := from.GetAttachedMedia(); ok {
|
||||
m.AttachedMedia = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -3071,14 +3176,26 @@ func (m *MessageMediaPoll) TypeInfo() tdp.Type {
|
||||
Name: "Results",
|
||||
SchemaName: "results",
|
||||
},
|
||||
{
|
||||
Name: "AttachedMedia",
|
||||
SchemaName: "attached_media",
|
||||
Null: !m.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (m *MessageMediaPoll) SetFlags() {
|
||||
if !(m.AttachedMedia == nil) {
|
||||
m.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageMediaPoll) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaPoll#4bd6e798 as nil")
|
||||
return fmt.Errorf("can't encode messageMediaPoll#773f4e66 as nil")
|
||||
}
|
||||
b.PutID(MessageMediaPollTypeID)
|
||||
return m.EncodeBare(b)
|
||||
@@ -3087,13 +3204,25 @@ func (m *MessageMediaPoll) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageMediaPoll) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaPoll#4bd6e798 as nil")
|
||||
return fmt.Errorf("can't encode messageMediaPoll#773f4e66 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#773f4e66: field flags: %w", err)
|
||||
}
|
||||
if err := m.Poll.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#4bd6e798: field poll: %w", err)
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#773f4e66: field poll: %w", err)
|
||||
}
|
||||
if err := m.Results.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#4bd6e798: field results: %w", err)
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#773f4e66: field results: %w", err)
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
if m.AttachedMedia == nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#773f4e66: field attached_media is nil")
|
||||
}
|
||||
if err := m.AttachedMedia.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaPoll#773f4e66: field attached_media: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -3101,10 +3230,10 @@ func (m *MessageMediaPoll) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageMediaPoll) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaPoll#4bd6e798 to nil")
|
||||
return fmt.Errorf("can't decode messageMediaPoll#773f4e66 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageMediaPollTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#773f4e66: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
@@ -3112,18 +3241,30 @@ func (m *MessageMediaPoll) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageMediaPoll) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaPoll#4bd6e798 to nil")
|
||||
return fmt.Errorf("can't decode messageMediaPoll#773f4e66 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#773f4e66: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := m.Poll.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: field poll: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#773f4e66: field poll: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := m.Results.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: field results: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#773f4e66: field results: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaPoll#773f4e66: field attached_media: %w", err)
|
||||
}
|
||||
m.AttachedMedia = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3143,6 +3284,24 @@ func (m *MessageMediaPoll) GetResults() (value PollResults) {
|
||||
return m.Results
|
||||
}
|
||||
|
||||
// SetAttachedMedia sets value of AttachedMedia conditional field.
|
||||
func (m *MessageMediaPoll) SetAttachedMedia(value MessageMediaClass) {
|
||||
m.Flags.Set(0)
|
||||
m.AttachedMedia = value
|
||||
}
|
||||
|
||||
// GetAttachedMedia returns value of AttachedMedia conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *MessageMediaPoll) GetAttachedMedia() (value MessageMediaClass, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return m.AttachedMedia, true
|
||||
}
|
||||
|
||||
// MessageMediaDice represents TL type `messageMediaDice#8cbec07`.
|
||||
// Dice-based animated sticker¹
|
||||
//
|
||||
@@ -5386,7 +5545,7 @@ const MessageMediaClassName = "MessageMedia"
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.MessageMediaEmpty: // messageMediaEmpty#3ded6320
|
||||
// case *tg.MessageMediaPhoto: // messageMediaPhoto#695150d7
|
||||
// case *tg.MessageMediaPhoto: // messageMediaPhoto#e216eb63
|
||||
// case *tg.MessageMediaGeo: // messageMediaGeo#56e0d474
|
||||
// case *tg.MessageMediaContact: // messageMediaContact#70322949
|
||||
// case *tg.MessageMediaUnsupported: // messageMediaUnsupported#9f84f49e
|
||||
@@ -5396,7 +5555,7 @@ const MessageMediaClassName = "MessageMedia"
|
||||
// case *tg.MessageMediaGame: // messageMediaGame#fdb19008
|
||||
// case *tg.MessageMediaInvoice: // messageMediaInvoice#f6a548d3
|
||||
// case *tg.MessageMediaGeoLive: // messageMediaGeoLive#b940c666
|
||||
// case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798
|
||||
// case *tg.MessageMediaPoll: // messageMediaPoll#773f4e66
|
||||
// case *tg.MessageMediaDice: // messageMediaDice#8cbec07
|
||||
// case *tg.MessageMediaStory: // messageMediaStory#68cb6283
|
||||
// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#aa073beb
|
||||
@@ -5440,7 +5599,7 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case MessageMediaPhotoTypeID:
|
||||
// Decoding messageMediaPhoto#695150d7.
|
||||
// Decoding messageMediaPhoto#e216eb63.
|
||||
v := MessageMediaPhoto{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err)
|
||||
@@ -5510,7 +5669,7 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case MessageMediaPollTypeID:
|
||||
// Decoding messageMediaPoll#4bd6e798.
|
||||
// Decoding messageMediaPoll#773f4e66.
|
||||
v := MessageMediaPoll{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err)
|
||||
|
||||
+76
-28
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessageReplyHeader represents TL type `messageReplyHeader#6917560b`.
|
||||
// MessageReplyHeader represents TL type `messageReplyHeader#1b97dd66`.
|
||||
// Message replies and thread¹ information
|
||||
//
|
||||
// Links:
|
||||
@@ -107,10 +107,14 @@ type MessageReplyHeader struct {
|
||||
//
|
||||
// Use SetTodoItemID and GetTodoItemID helpers.
|
||||
TodoItemID int
|
||||
// PollOption field of MessageReplyHeader.
|
||||
//
|
||||
// Use SetPollOption and GetPollOption helpers.
|
||||
PollOption []byte
|
||||
}
|
||||
|
||||
// MessageReplyHeaderTypeID is TL type id of MessageReplyHeader.
|
||||
const MessageReplyHeaderTypeID = 0x6917560b
|
||||
const MessageReplyHeaderTypeID = 0x1b97dd66
|
||||
|
||||
// construct implements constructor of MessageReplyHeaderClass.
|
||||
func (m MessageReplyHeader) construct() MessageReplyHeaderClass { return &m }
|
||||
@@ -168,6 +172,9 @@ func (m *MessageReplyHeader) Zero() bool {
|
||||
if !(m.TodoItemID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.PollOption == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -195,6 +202,7 @@ func (m *MessageReplyHeader) FillFrom(from interface {
|
||||
GetQuoteEntities() (value []MessageEntityClass, ok bool)
|
||||
GetQuoteOffset() (value int, ok bool)
|
||||
GetTodoItemID() (value int, ok bool)
|
||||
GetPollOption() (value []byte, ok bool)
|
||||
}) {
|
||||
m.ReplyToScheduled = from.GetReplyToScheduled()
|
||||
m.ForumTopic = from.GetForumTopic()
|
||||
@@ -235,6 +243,10 @@ func (m *MessageReplyHeader) FillFrom(from interface {
|
||||
m.TodoItemID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetPollOption(); ok {
|
||||
m.PollOption = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -320,6 +332,11 @@ func (m *MessageReplyHeader) TypeInfo() tdp.Type {
|
||||
SchemaName: "todo_item_id",
|
||||
Null: !m.Flags.Has(11),
|
||||
},
|
||||
{
|
||||
Name: "PollOption",
|
||||
SchemaName: "poll_option",
|
||||
Null: !m.Flags.Has(12),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -362,12 +379,15 @@ func (m *MessageReplyHeader) SetFlags() {
|
||||
if !(m.TodoItemID == 0) {
|
||||
m.Flags.Set(11)
|
||||
}
|
||||
if !(m.PollOption == nil) {
|
||||
m.Flags.Set(12)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageReplyHeader) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageReplyHeader#6917560b as nil")
|
||||
return fmt.Errorf("can't encode messageReplyHeader#1b97dd66 as nil")
|
||||
}
|
||||
b.PutID(MessageReplyHeaderTypeID)
|
||||
return m.EncodeBare(b)
|
||||
@@ -376,34 +396,34 @@ func (m *MessageReplyHeader) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageReplyHeader) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageReplyHeader#6917560b as nil")
|
||||
return fmt.Errorf("can't encode messageReplyHeader#1b97dd66 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field flags: %w", err)
|
||||
}
|
||||
if m.Flags.Has(4) {
|
||||
b.PutInt(m.ReplyToMsgID)
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
if m.ReplyToPeerID == nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field reply_to_peer_id is nil")
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field reply_to_peer_id is nil")
|
||||
}
|
||||
if err := m.ReplyToPeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field reply_to_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field reply_to_peer_id: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(5) {
|
||||
if err := m.ReplyFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field reply_from: %w", err)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field reply_from: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(8) {
|
||||
if m.ReplyMedia == nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field reply_media is nil")
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field reply_media is nil")
|
||||
}
|
||||
if err := m.ReplyMedia.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field reply_media: %w", err)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field reply_media: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(1) {
|
||||
@@ -416,10 +436,10 @@ func (m *MessageReplyHeader) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(m.QuoteEntities))
|
||||
for idx, v := range m.QuoteEntities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field quote_entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field quote_entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#6917560b: field quote_entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode messageReplyHeader#1b97dd66: field quote_entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,16 +449,19 @@ func (m *MessageReplyHeader) EncodeBare(b *bin.Buffer) error {
|
||||
if m.Flags.Has(11) {
|
||||
b.PutInt(m.TodoItemID)
|
||||
}
|
||||
if m.Flags.Has(12) {
|
||||
b.PutBytes(m.PollOption)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageReplyHeader) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageReplyHeader#6917560b to nil")
|
||||
return fmt.Errorf("can't decode messageReplyHeader#1b97dd66 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageReplyHeaderTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
@@ -446,11 +469,11 @@ func (m *MessageReplyHeader) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageReplyHeader#6917560b to nil")
|
||||
return fmt.Errorf("can't decode messageReplyHeader#1b97dd66 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
m.ReplyToScheduled = m.Flags.Has(2)
|
||||
@@ -459,47 +482,47 @@ func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error {
|
||||
if m.Flags.Has(4) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field reply_to_msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field reply_to_msg_id: %w", err)
|
||||
}
|
||||
m.ReplyToMsgID = value
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field reply_to_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field reply_to_peer_id: %w", err)
|
||||
}
|
||||
m.ReplyToPeerID = value
|
||||
}
|
||||
if m.Flags.Has(5) {
|
||||
if err := m.ReplyFrom.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field reply_from: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field reply_from: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(8) {
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field reply_media: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field reply_media: %w", err)
|
||||
}
|
||||
m.ReplyMedia = value
|
||||
}
|
||||
if m.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field reply_to_top_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field reply_to_top_id: %w", err)
|
||||
}
|
||||
m.ReplyToTopID = value
|
||||
}
|
||||
if m.Flags.Has(6) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field quote_text: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field quote_text: %w", err)
|
||||
}
|
||||
m.QuoteText = value
|
||||
}
|
||||
if m.Flags.Has(7) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field quote_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field quote_entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -508,7 +531,7 @@ func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field quote_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field quote_entities: %w", err)
|
||||
}
|
||||
m.QuoteEntities = append(m.QuoteEntities, value)
|
||||
}
|
||||
@@ -516,17 +539,24 @@ func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error {
|
||||
if m.Flags.Has(10) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field quote_offset: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field quote_offset: %w", err)
|
||||
}
|
||||
m.QuoteOffset = value
|
||||
}
|
||||
if m.Flags.Has(11) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#6917560b: field todo_item_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field todo_item_id: %w", err)
|
||||
}
|
||||
m.TodoItemID = value
|
||||
}
|
||||
if m.Flags.Has(12) {
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageReplyHeader#1b97dd66: field poll_option: %w", err)
|
||||
}
|
||||
m.PollOption = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -749,6 +779,24 @@ func (m *MessageReplyHeader) GetTodoItemID() (value int, ok bool) {
|
||||
return m.TodoItemID, true
|
||||
}
|
||||
|
||||
// SetPollOption sets value of PollOption conditional field.
|
||||
func (m *MessageReplyHeader) SetPollOption(value []byte) {
|
||||
m.Flags.Set(12)
|
||||
m.PollOption = value
|
||||
}
|
||||
|
||||
// GetPollOption returns value of PollOption conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *MessageReplyHeader) GetPollOption() (value []byte, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags.Has(12) {
|
||||
return value, false
|
||||
}
|
||||
return m.PollOption, true
|
||||
}
|
||||
|
||||
// MapQuoteEntities returns field QuoteEntities wrapped in MessageEntityClassArray helper.
|
||||
func (m *MessageReplyHeader) MapQuoteEntities() (value MessageEntityClassArray, ok bool) {
|
||||
if !m.Flags.Has(7) {
|
||||
@@ -941,7 +989,7 @@ const MessageReplyHeaderClassName = "MessageReplyHeader"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.MessageReplyHeader: // messageReplyHeader#6917560b
|
||||
// case *tg.MessageReplyHeader: // messageReplyHeader#1b97dd66
|
||||
// case *tg.MessageReplyStoryHeader: // messageReplyStoryHeader#e5af939
|
||||
// default: panic(v)
|
||||
// }
|
||||
@@ -972,7 +1020,7 @@ func DecodeMessageReplyHeader(buf *bin.Buffer) (MessageReplyHeaderClass, error)
|
||||
}
|
||||
switch id {
|
||||
case MessageReplyHeaderTypeID:
|
||||
// Decoding messageReplyHeader#6917560b.
|
||||
// Decoding messageReplyHeader#1b97dd66.
|
||||
v := MessageReplyHeader{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", err)
|
||||
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesAddPollAnswerRequest represents TL type `messages.addPollAnswer#19bc4b6d`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.addPollAnswer for reference.
|
||||
type MessagesAddPollAnswerRequest struct {
|
||||
// Peer field of MessagesAddPollAnswerRequest.
|
||||
Peer InputPeerClass
|
||||
// MsgID field of MessagesAddPollAnswerRequest.
|
||||
MsgID int
|
||||
// Answer field of MessagesAddPollAnswerRequest.
|
||||
Answer PollAnswerClass
|
||||
}
|
||||
|
||||
// MessagesAddPollAnswerRequestTypeID is TL type id of MessagesAddPollAnswerRequest.
|
||||
const MessagesAddPollAnswerRequestTypeID = 0x19bc4b6d
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesAddPollAnswerRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesAddPollAnswerRequest{}
|
||||
_ bin.Decoder = &MessagesAddPollAnswerRequest{}
|
||||
_ bin.BareEncoder = &MessagesAddPollAnswerRequest{}
|
||||
_ bin.BareDecoder = &MessagesAddPollAnswerRequest{}
|
||||
)
|
||||
|
||||
func (a *MessagesAddPollAnswerRequest) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(a.Answer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *MessagesAddPollAnswerRequest) String() string {
|
||||
if a == nil {
|
||||
return "MessagesAddPollAnswerRequest(nil)"
|
||||
}
|
||||
type Alias MessagesAddPollAnswerRequest
|
||||
return fmt.Sprintf("MessagesAddPollAnswerRequest%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesAddPollAnswerRequest from given interface.
|
||||
func (a *MessagesAddPollAnswerRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
GetAnswer() (value PollAnswerClass)
|
||||
}) {
|
||||
a.Peer = from.GetPeer()
|
||||
a.MsgID = from.GetMsgID()
|
||||
a.Answer = from.GetAnswer()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesAddPollAnswerRequest) TypeID() uint32 {
|
||||
return MessagesAddPollAnswerRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesAddPollAnswerRequest) TypeName() string {
|
||||
return "messages.addPollAnswer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *MessagesAddPollAnswerRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.addPollAnswer",
|
||||
ID: MessagesAddPollAnswerRequestTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Answer",
|
||||
SchemaName: "answer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *MessagesAddPollAnswerRequest) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode messages.addPollAnswer#19bc4b6d as nil")
|
||||
}
|
||||
b.PutID(MessagesAddPollAnswerRequestTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *MessagesAddPollAnswerRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode messages.addPollAnswer#19bc4b6d as nil")
|
||||
}
|
||||
if a.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.addPollAnswer#19bc4b6d: field peer is nil")
|
||||
}
|
||||
if err := a.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.addPollAnswer#19bc4b6d: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(a.MsgID)
|
||||
if a.Answer == nil {
|
||||
return fmt.Errorf("unable to encode messages.addPollAnswer#19bc4b6d: field answer is nil")
|
||||
}
|
||||
if err := a.Answer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.addPollAnswer#19bc4b6d: field answer: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *MessagesAddPollAnswerRequest) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode messages.addPollAnswer#19bc4b6d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesAddPollAnswerRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.addPollAnswer#19bc4b6d: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *MessagesAddPollAnswerRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode messages.addPollAnswer#19bc4b6d to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.addPollAnswer#19bc4b6d: field peer: %w", err)
|
||||
}
|
||||
a.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.addPollAnswer#19bc4b6d: field msg_id: %w", err)
|
||||
}
|
||||
a.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodePollAnswer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.addPollAnswer#19bc4b6d: field answer: %w", err)
|
||||
}
|
||||
a.Answer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (a *MessagesAddPollAnswerRequest) GetPeer() (value InputPeerClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Peer
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (a *MessagesAddPollAnswerRequest) GetMsgID() (value int) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.MsgID
|
||||
}
|
||||
|
||||
// GetAnswer returns value of Answer field.
|
||||
func (a *MessagesAddPollAnswerRequest) GetAnswer() (value PollAnswerClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Answer
|
||||
}
|
||||
|
||||
// MessagesAddPollAnswer invokes method messages.addPollAnswer#19bc4b6d returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.addPollAnswer for reference.
|
||||
func (c *Client) MessagesAddPollAnswer(ctx context.Context, request *MessagesAddPollAnswerRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Updates, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesComposeMessageWithAIRequest represents TL type `messages.composeMessageWithAI#fd426afe`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.composeMessageWithAI for reference.
|
||||
type MessagesComposeMessageWithAIRequest struct {
|
||||
// Flags field of MessagesComposeMessageWithAIRequest.
|
||||
Flags bin.Fields
|
||||
// Proofread field of MessagesComposeMessageWithAIRequest.
|
||||
Proofread bool
|
||||
// Emojify field of MessagesComposeMessageWithAIRequest.
|
||||
Emojify bool
|
||||
// Text field of MessagesComposeMessageWithAIRequest.
|
||||
Text TextWithEntities
|
||||
// TranslateToLang field of MessagesComposeMessageWithAIRequest.
|
||||
//
|
||||
// Use SetTranslateToLang and GetTranslateToLang helpers.
|
||||
TranslateToLang string
|
||||
// ChangeTone field of MessagesComposeMessageWithAIRequest.
|
||||
//
|
||||
// Use SetChangeTone and GetChangeTone helpers.
|
||||
ChangeTone string
|
||||
}
|
||||
|
||||
// MessagesComposeMessageWithAIRequestTypeID is TL type id of MessagesComposeMessageWithAIRequest.
|
||||
const MessagesComposeMessageWithAIRequestTypeID = 0xfd426afe
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesComposeMessageWithAIRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesComposeMessageWithAIRequest{}
|
||||
_ bin.Decoder = &MessagesComposeMessageWithAIRequest{}
|
||||
_ bin.BareEncoder = &MessagesComposeMessageWithAIRequest{}
|
||||
_ bin.BareDecoder = &MessagesComposeMessageWithAIRequest{}
|
||||
)
|
||||
|
||||
func (c *MessagesComposeMessageWithAIRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.Proofread == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.Emojify == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.Text.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.TranslateToLang == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.ChangeTone == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *MessagesComposeMessageWithAIRequest) String() string {
|
||||
if c == nil {
|
||||
return "MessagesComposeMessageWithAIRequest(nil)"
|
||||
}
|
||||
type Alias MessagesComposeMessageWithAIRequest
|
||||
return fmt.Sprintf("MessagesComposeMessageWithAIRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesComposeMessageWithAIRequest from given interface.
|
||||
func (c *MessagesComposeMessageWithAIRequest) FillFrom(from interface {
|
||||
GetProofread() (value bool)
|
||||
GetEmojify() (value bool)
|
||||
GetText() (value TextWithEntities)
|
||||
GetTranslateToLang() (value string, ok bool)
|
||||
GetChangeTone() (value string, ok bool)
|
||||
}) {
|
||||
c.Proofread = from.GetProofread()
|
||||
c.Emojify = from.GetEmojify()
|
||||
c.Text = from.GetText()
|
||||
if val, ok := from.GetTranslateToLang(); ok {
|
||||
c.TranslateToLang = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetChangeTone(); ok {
|
||||
c.ChangeTone = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesComposeMessageWithAIRequest) TypeID() uint32 {
|
||||
return MessagesComposeMessageWithAIRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesComposeMessageWithAIRequest) TypeName() string {
|
||||
return "messages.composeMessageWithAI"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *MessagesComposeMessageWithAIRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.composeMessageWithAI",
|
||||
ID: MessagesComposeMessageWithAIRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Proofread",
|
||||
SchemaName: "proofread",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Emojify",
|
||||
SchemaName: "emojify",
|
||||
Null: !c.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "Text",
|
||||
SchemaName: "text",
|
||||
},
|
||||
{
|
||||
Name: "TranslateToLang",
|
||||
SchemaName: "translate_to_lang",
|
||||
Null: !c.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "ChangeTone",
|
||||
SchemaName: "change_tone",
|
||||
Null: !c.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *MessagesComposeMessageWithAIRequest) SetFlags() {
|
||||
if !(c.Proofread == false) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
if !(c.Emojify == false) {
|
||||
c.Flags.Set(3)
|
||||
}
|
||||
if !(c.TranslateToLang == "") {
|
||||
c.Flags.Set(1)
|
||||
}
|
||||
if !(c.ChangeTone == "") {
|
||||
c.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *MessagesComposeMessageWithAIRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.composeMessageWithAI#fd426afe as nil")
|
||||
}
|
||||
b.PutID(MessagesComposeMessageWithAIRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *MessagesComposeMessageWithAIRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.composeMessageWithAI#fd426afe as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.composeMessageWithAI#fd426afe: field flags: %w", err)
|
||||
}
|
||||
if err := c.Text.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.composeMessageWithAI#fd426afe: field text: %w", err)
|
||||
}
|
||||
if c.Flags.Has(1) {
|
||||
b.PutString(c.TranslateToLang)
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
b.PutString(c.ChangeTone)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *MessagesComposeMessageWithAIRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.composeMessageWithAI#fd426afe to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesComposeMessageWithAIRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composeMessageWithAI#fd426afe: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *MessagesComposeMessageWithAIRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.composeMessageWithAI#fd426afe to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composeMessageWithAI#fd426afe: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.Proofread = c.Flags.Has(0)
|
||||
c.Emojify = c.Flags.Has(3)
|
||||
{
|
||||
if err := c.Text.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composeMessageWithAI#fd426afe: field text: %w", err)
|
||||
}
|
||||
}
|
||||
if c.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composeMessageWithAI#fd426afe: field translate_to_lang: %w", err)
|
||||
}
|
||||
c.TranslateToLang = value
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composeMessageWithAI#fd426afe: field change_tone: %w", err)
|
||||
}
|
||||
c.ChangeTone = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetProofread sets value of Proofread conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) SetProofread(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(0)
|
||||
c.Proofread = true
|
||||
} else {
|
||||
c.Flags.Unset(0)
|
||||
c.Proofread = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetProofread returns value of Proofread conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) GetProofread() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetEmojify sets value of Emojify conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) SetEmojify(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(3)
|
||||
c.Emojify = true
|
||||
} else {
|
||||
c.Flags.Unset(3)
|
||||
c.Emojify = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmojify returns value of Emojify conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) GetEmojify() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(3)
|
||||
}
|
||||
|
||||
// GetText returns value of Text field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) GetText() (value TextWithEntities) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Text
|
||||
}
|
||||
|
||||
// SetTranslateToLang sets value of TranslateToLang conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) SetTranslateToLang(value string) {
|
||||
c.Flags.Set(1)
|
||||
c.TranslateToLang = value
|
||||
}
|
||||
|
||||
// GetTranslateToLang returns value of TranslateToLang conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *MessagesComposeMessageWithAIRequest) GetTranslateToLang() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return c.TranslateToLang, true
|
||||
}
|
||||
|
||||
// SetChangeTone sets value of ChangeTone conditional field.
|
||||
func (c *MessagesComposeMessageWithAIRequest) SetChangeTone(value string) {
|
||||
c.Flags.Set(2)
|
||||
c.ChangeTone = value
|
||||
}
|
||||
|
||||
// GetChangeTone returns value of ChangeTone conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *MessagesComposeMessageWithAIRequest) GetChangeTone() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return c.ChangeTone, true
|
||||
}
|
||||
|
||||
// MessagesComposeMessageWithAI invokes method messages.composeMessageWithAI#fd426afe returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.composeMessageWithAI for reference.
|
||||
func (c *Client) MessagesComposeMessageWithAI(ctx context.Context, request *MessagesComposeMessageWithAIRequest) (*MessagesComposedMessageWithAI, error) {
|
||||
var result MessagesComposedMessageWithAI
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,227 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesComposedMessageWithAI represents TL type `messages.composedMessageWithAI#90d7adfa`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messages.composedMessageWithAI for reference.
|
||||
type MessagesComposedMessageWithAI struct {
|
||||
// Flags field of MessagesComposedMessageWithAI.
|
||||
Flags bin.Fields
|
||||
// ResultText field of MessagesComposedMessageWithAI.
|
||||
ResultText TextWithEntities
|
||||
// DiffText field of MessagesComposedMessageWithAI.
|
||||
//
|
||||
// Use SetDiffText and GetDiffText helpers.
|
||||
DiffText TextWithEntities
|
||||
}
|
||||
|
||||
// MessagesComposedMessageWithAITypeID is TL type id of MessagesComposedMessageWithAI.
|
||||
const MessagesComposedMessageWithAITypeID = 0x90d7adfa
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesComposedMessageWithAI.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesComposedMessageWithAI{}
|
||||
_ bin.Decoder = &MessagesComposedMessageWithAI{}
|
||||
_ bin.BareEncoder = &MessagesComposedMessageWithAI{}
|
||||
_ bin.BareDecoder = &MessagesComposedMessageWithAI{}
|
||||
)
|
||||
|
||||
func (c *MessagesComposedMessageWithAI) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.ResultText.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.DiffText.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *MessagesComposedMessageWithAI) String() string {
|
||||
if c == nil {
|
||||
return "MessagesComposedMessageWithAI(nil)"
|
||||
}
|
||||
type Alias MessagesComposedMessageWithAI
|
||||
return fmt.Sprintf("MessagesComposedMessageWithAI%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesComposedMessageWithAI from given interface.
|
||||
func (c *MessagesComposedMessageWithAI) FillFrom(from interface {
|
||||
GetResultText() (value TextWithEntities)
|
||||
GetDiffText() (value TextWithEntities, ok bool)
|
||||
}) {
|
||||
c.ResultText = from.GetResultText()
|
||||
if val, ok := from.GetDiffText(); ok {
|
||||
c.DiffText = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesComposedMessageWithAI) TypeID() uint32 {
|
||||
return MessagesComposedMessageWithAITypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesComposedMessageWithAI) TypeName() string {
|
||||
return "messages.composedMessageWithAI"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *MessagesComposedMessageWithAI) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.composedMessageWithAI",
|
||||
ID: MessagesComposedMessageWithAITypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ResultText",
|
||||
SchemaName: "result_text",
|
||||
},
|
||||
{
|
||||
Name: "DiffText",
|
||||
SchemaName: "diff_text",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *MessagesComposedMessageWithAI) SetFlags() {
|
||||
if !(c.DiffText.Zero()) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *MessagesComposedMessageWithAI) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.composedMessageWithAI#90d7adfa as nil")
|
||||
}
|
||||
b.PutID(MessagesComposedMessageWithAITypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *MessagesComposedMessageWithAI) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.composedMessageWithAI#90d7adfa as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.composedMessageWithAI#90d7adfa: field flags: %w", err)
|
||||
}
|
||||
if err := c.ResultText.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.composedMessageWithAI#90d7adfa: field result_text: %w", err)
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
if err := c.DiffText.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.composedMessageWithAI#90d7adfa: field diff_text: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *MessagesComposedMessageWithAI) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.composedMessageWithAI#90d7adfa to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesComposedMessageWithAITypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composedMessageWithAI#90d7adfa: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *MessagesComposedMessageWithAI) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.composedMessageWithAI#90d7adfa to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composedMessageWithAI#90d7adfa: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := c.ResultText.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composedMessageWithAI#90d7adfa: field result_text: %w", err)
|
||||
}
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
if err := c.DiffText.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.composedMessageWithAI#90d7adfa: field diff_text: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetResultText returns value of ResultText field.
|
||||
func (c *MessagesComposedMessageWithAI) GetResultText() (value TextWithEntities) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.ResultText
|
||||
}
|
||||
|
||||
// SetDiffText sets value of DiffText conditional field.
|
||||
func (c *MessagesComposedMessageWithAI) SetDiffText(value TextWithEntities) {
|
||||
c.Flags.Set(0)
|
||||
c.DiffText = value
|
||||
}
|
||||
|
||||
// GetDiffText returns value of DiffText conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *MessagesComposedMessageWithAI) GetDiffText() (value TextWithEntities, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return c.DiffText, true
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesDeletePollAnswerRequest represents TL type `messages.deletePollAnswer#ac8505a5`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.deletePollAnswer for reference.
|
||||
type MessagesDeletePollAnswerRequest struct {
|
||||
// Peer field of MessagesDeletePollAnswerRequest.
|
||||
Peer InputPeerClass
|
||||
// MsgID field of MessagesDeletePollAnswerRequest.
|
||||
MsgID int
|
||||
// Option field of MessagesDeletePollAnswerRequest.
|
||||
Option []byte
|
||||
}
|
||||
|
||||
// MessagesDeletePollAnswerRequestTypeID is TL type id of MessagesDeletePollAnswerRequest.
|
||||
const MessagesDeletePollAnswerRequestTypeID = 0xac8505a5
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesDeletePollAnswerRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesDeletePollAnswerRequest{}
|
||||
_ bin.Decoder = &MessagesDeletePollAnswerRequest{}
|
||||
_ bin.BareEncoder = &MessagesDeletePollAnswerRequest{}
|
||||
_ bin.BareDecoder = &MessagesDeletePollAnswerRequest{}
|
||||
)
|
||||
|
||||
func (d *MessagesDeletePollAnswerRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(d.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.Option == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *MessagesDeletePollAnswerRequest) String() string {
|
||||
if d == nil {
|
||||
return "MessagesDeletePollAnswerRequest(nil)"
|
||||
}
|
||||
type Alias MessagesDeletePollAnswerRequest
|
||||
return fmt.Sprintf("MessagesDeletePollAnswerRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesDeletePollAnswerRequest from given interface.
|
||||
func (d *MessagesDeletePollAnswerRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
GetOption() (value []byte)
|
||||
}) {
|
||||
d.Peer = from.GetPeer()
|
||||
d.MsgID = from.GetMsgID()
|
||||
d.Option = from.GetOption()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesDeletePollAnswerRequest) TypeID() uint32 {
|
||||
return MessagesDeletePollAnswerRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesDeletePollAnswerRequest) TypeName() string {
|
||||
return "messages.deletePollAnswer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *MessagesDeletePollAnswerRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.deletePollAnswer",
|
||||
ID: MessagesDeletePollAnswerRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Option",
|
||||
SchemaName: "option",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *MessagesDeletePollAnswerRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.deletePollAnswer#ac8505a5 as nil")
|
||||
}
|
||||
b.PutID(MessagesDeletePollAnswerRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *MessagesDeletePollAnswerRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.deletePollAnswer#ac8505a5 as nil")
|
||||
}
|
||||
if d.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.deletePollAnswer#ac8505a5: field peer is nil")
|
||||
}
|
||||
if err := d.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.deletePollAnswer#ac8505a5: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(d.MsgID)
|
||||
b.PutBytes(d.Option)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *MessagesDeletePollAnswerRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.deletePollAnswer#ac8505a5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesDeletePollAnswerRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deletePollAnswer#ac8505a5: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *MessagesDeletePollAnswerRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.deletePollAnswer#ac8505a5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deletePollAnswer#ac8505a5: field peer: %w", err)
|
||||
}
|
||||
d.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deletePollAnswer#ac8505a5: field msg_id: %w", err)
|
||||
}
|
||||
d.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deletePollAnswer#ac8505a5: field option: %w", err)
|
||||
}
|
||||
d.Option = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (d *MessagesDeletePollAnswerRequest) GetPeer() (value InputPeerClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Peer
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (d *MessagesDeletePollAnswerRequest) GetMsgID() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.MsgID
|
||||
}
|
||||
|
||||
// GetOption returns value of Option field.
|
||||
func (d *MessagesDeletePollAnswerRequest) GetOption() (value []byte) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Option
|
||||
}
|
||||
|
||||
// MessagesDeletePollAnswer invokes method messages.deletePollAnswer#ac8505a5 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.deletePollAnswer for reference.
|
||||
func (c *Client) MessagesDeletePollAnswer(ctx context.Context, request *MessagesDeletePollAnswerRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Updates, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
Generated
+109
@@ -1830,6 +1830,107 @@ func (i *InputMessagesFilterPinned) DecodeBare(b *bin.Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InputMessagesFilterPoll represents TL type `inputMessagesFilterPoll#fa2bc90a`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMessagesFilterPoll for reference.
|
||||
type InputMessagesFilterPoll struct {
|
||||
}
|
||||
|
||||
// InputMessagesFilterPollTypeID is TL type id of InputMessagesFilterPoll.
|
||||
const InputMessagesFilterPollTypeID = 0xfa2bc90a
|
||||
|
||||
// construct implements constructor of MessagesFilterClass.
|
||||
func (i InputMessagesFilterPoll) construct() MessagesFilterClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputMessagesFilterPoll.
|
||||
var (
|
||||
_ bin.Encoder = &InputMessagesFilterPoll{}
|
||||
_ bin.Decoder = &InputMessagesFilterPoll{}
|
||||
_ bin.BareEncoder = &InputMessagesFilterPoll{}
|
||||
_ bin.BareDecoder = &InputMessagesFilterPoll{}
|
||||
|
||||
_ MessagesFilterClass = &InputMessagesFilterPoll{}
|
||||
)
|
||||
|
||||
func (i *InputMessagesFilterPoll) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputMessagesFilterPoll) String() string {
|
||||
if i == nil {
|
||||
return "InputMessagesFilterPoll(nil)"
|
||||
}
|
||||
type Alias InputMessagesFilterPoll
|
||||
return fmt.Sprintf("InputMessagesFilterPoll%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputMessagesFilterPoll) TypeID() uint32 {
|
||||
return InputMessagesFilterPollTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputMessagesFilterPoll) TypeName() string {
|
||||
return "inputMessagesFilterPoll"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputMessagesFilterPoll) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputMessagesFilterPoll",
|
||||
ID: InputMessagesFilterPollTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMessagesFilterPoll) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMessagesFilterPoll#fa2bc90a as nil")
|
||||
}
|
||||
b.PutID(InputMessagesFilterPollTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMessagesFilterPoll) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMessagesFilterPoll#fa2bc90a as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMessagesFilterPoll) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMessagesFilterPoll#fa2bc90a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMessagesFilterPollTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMessagesFilterPoll#fa2bc90a: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMessagesFilterPoll) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMessagesFilterPoll#fa2bc90a to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MessagesFilterClassName is schema name of MessagesFilterClass.
|
||||
const MessagesFilterClassName = "MessagesFilter"
|
||||
|
||||
@@ -1861,6 +1962,7 @@ const MessagesFilterClassName = "MessagesFilter"
|
||||
// case *tg.InputMessagesFilterGeo: // inputMessagesFilterGeo#e7026d0d
|
||||
// case *tg.InputMessagesFilterContacts: // inputMessagesFilterContacts#e062db83
|
||||
// case *tg.InputMessagesFilterPinned: // inputMessagesFilterPinned#1bb00451
|
||||
// case *tg.InputMessagesFilterPoll: // inputMessagesFilterPoll#fa2bc90a
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MessagesFilterClass interface {
|
||||
@@ -2008,6 +2110,13 @@ func DecodeMessagesFilter(buf *bin.Buffer) (MessagesFilterClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputMessagesFilterPollTypeID:
|
||||
// Decoding inputMessagesFilterPoll#fa2bc90a.
|
||||
v := InputMessagesFilterPoll{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MessagesFilterClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
+39
-12
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesGetPollResultsRequest represents TL type `messages.getPollResults#73bb643b`.
|
||||
// MessagesGetPollResultsRequest represents TL type `messages.getPollResults#eda3e33b`.
|
||||
// Get poll results
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getPollResults for reference.
|
||||
@@ -40,10 +40,12 @@ type MessagesGetPollResultsRequest struct {
|
||||
Peer InputPeerClass
|
||||
// Message ID of poll message
|
||||
MsgID int
|
||||
// PollHash field of MessagesGetPollResultsRequest.
|
||||
PollHash int64
|
||||
}
|
||||
|
||||
// MessagesGetPollResultsRequestTypeID is TL type id of MessagesGetPollResultsRequest.
|
||||
const MessagesGetPollResultsRequestTypeID = 0x73bb643b
|
||||
const MessagesGetPollResultsRequestTypeID = 0xeda3e33b
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesGetPollResultsRequest.
|
||||
var (
|
||||
@@ -63,6 +65,9 @@ func (g *MessagesGetPollResultsRequest) Zero() bool {
|
||||
if !(g.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.PollHash == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -80,9 +85,11 @@ func (g *MessagesGetPollResultsRequest) String() string {
|
||||
func (g *MessagesGetPollResultsRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
GetPollHash() (value int64)
|
||||
}) {
|
||||
g.Peer = from.GetPeer()
|
||||
g.MsgID = from.GetMsgID()
|
||||
g.PollHash = from.GetPollHash()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -116,6 +123,10 @@ func (g *MessagesGetPollResultsRequest) TypeInfo() tdp.Type {
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "PollHash",
|
||||
SchemaName: "poll_hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -123,7 +134,7 @@ func (g *MessagesGetPollResultsRequest) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *MessagesGetPollResultsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getPollResults#73bb643b as nil")
|
||||
return fmt.Errorf("can't encode messages.getPollResults#eda3e33b as nil")
|
||||
}
|
||||
b.PutID(MessagesGetPollResultsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
@@ -132,25 +143,26 @@ func (g *MessagesGetPollResultsRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *MessagesGetPollResultsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getPollResults#73bb643b as nil")
|
||||
return fmt.Errorf("can't encode messages.getPollResults#eda3e33b as nil")
|
||||
}
|
||||
if g.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.getPollResults#73bb643b: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.getPollResults#eda3e33b: field peer is nil")
|
||||
}
|
||||
if err := g.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getPollResults#73bb643b: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.getPollResults#eda3e33b: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(g.MsgID)
|
||||
b.PutLong(g.PollHash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *MessagesGetPollResultsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getPollResults#73bb643b to nil")
|
||||
return fmt.Errorf("can't decode messages.getPollResults#eda3e33b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesGetPollResultsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#eda3e33b: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
@@ -158,22 +170,29 @@ func (g *MessagesGetPollResultsRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *MessagesGetPollResultsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getPollResults#73bb643b to nil")
|
||||
return fmt.Errorf("can't decode messages.getPollResults#eda3e33b to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#eda3e33b: field peer: %w", err)
|
||||
}
|
||||
g.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: field msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#eda3e33b: field msg_id: %w", err)
|
||||
}
|
||||
g.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getPollResults#eda3e33b: field poll_hash: %w", err)
|
||||
}
|
||||
g.PollHash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -193,7 +212,15 @@ func (g *MessagesGetPollResultsRequest) GetMsgID() (value int) {
|
||||
return g.MsgID
|
||||
}
|
||||
|
||||
// MessagesGetPollResults invokes method messages.getPollResults#73bb643b returning error if any.
|
||||
// GetPollHash returns value of PollHash field.
|
||||
func (g *MessagesGetPollResultsRequest) GetPollHash() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.PollHash
|
||||
}
|
||||
|
||||
// MessagesGetPollResults invokes method messages.getPollResults#eda3e33b returning error if any.
|
||||
// Get poll results
|
||||
//
|
||||
// Possible errors:
|
||||
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesGetUnreadPollVotesRequest represents TL type `messages.getUnreadPollVotes#43286cf2`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getUnreadPollVotes for reference.
|
||||
type MessagesGetUnreadPollVotesRequest struct {
|
||||
// Flags field of MessagesGetUnreadPollVotesRequest.
|
||||
Flags bin.Fields
|
||||
// Peer field of MessagesGetUnreadPollVotesRequest.
|
||||
Peer InputPeerClass
|
||||
// TopMsgID field of MessagesGetUnreadPollVotesRequest.
|
||||
//
|
||||
// Use SetTopMsgID and GetTopMsgID helpers.
|
||||
TopMsgID int
|
||||
// OffsetID field of MessagesGetUnreadPollVotesRequest.
|
||||
OffsetID int
|
||||
// AddOffset field of MessagesGetUnreadPollVotesRequest.
|
||||
AddOffset int
|
||||
// Limit field of MessagesGetUnreadPollVotesRequest.
|
||||
Limit int
|
||||
// MaxID field of MessagesGetUnreadPollVotesRequest.
|
||||
MaxID int
|
||||
// MinID field of MessagesGetUnreadPollVotesRequest.
|
||||
MinID int
|
||||
}
|
||||
|
||||
// MessagesGetUnreadPollVotesRequestTypeID is TL type id of MessagesGetUnreadPollVotesRequest.
|
||||
const MessagesGetUnreadPollVotesRequestTypeID = 0x43286cf2
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesGetUnreadPollVotesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesGetUnreadPollVotesRequest{}
|
||||
_ bin.Decoder = &MessagesGetUnreadPollVotesRequest{}
|
||||
_ bin.BareEncoder = &MessagesGetUnreadPollVotesRequest{}
|
||||
_ bin.BareDecoder = &MessagesGetUnreadPollVotesRequest{}
|
||||
)
|
||||
|
||||
func (g *MessagesGetUnreadPollVotesRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(g.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(g.TopMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.OffsetID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.AddOffset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Limit == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.MaxID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.MinID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) String() string {
|
||||
if g == nil {
|
||||
return "MessagesGetUnreadPollVotesRequest(nil)"
|
||||
}
|
||||
type Alias MessagesGetUnreadPollVotesRequest
|
||||
return fmt.Sprintf("MessagesGetUnreadPollVotesRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesGetUnreadPollVotesRequest from given interface.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetTopMsgID() (value int, ok bool)
|
||||
GetOffsetID() (value int)
|
||||
GetAddOffset() (value int)
|
||||
GetLimit() (value int)
|
||||
GetMaxID() (value int)
|
||||
GetMinID() (value int)
|
||||
}) {
|
||||
g.Peer = from.GetPeer()
|
||||
if val, ok := from.GetTopMsgID(); ok {
|
||||
g.TopMsgID = val
|
||||
}
|
||||
|
||||
g.OffsetID = from.GetOffsetID()
|
||||
g.AddOffset = from.GetAddOffset()
|
||||
g.Limit = from.GetLimit()
|
||||
g.MaxID = from.GetMaxID()
|
||||
g.MinID = from.GetMinID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesGetUnreadPollVotesRequest) TypeID() uint32 {
|
||||
return MessagesGetUnreadPollVotesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesGetUnreadPollVotesRequest) TypeName() string {
|
||||
return "messages.getUnreadPollVotes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.getUnreadPollVotes",
|
||||
ID: MessagesGetUnreadPollVotesRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "TopMsgID",
|
||||
SchemaName: "top_msg_id",
|
||||
Null: !g.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "OffsetID",
|
||||
SchemaName: "offset_id",
|
||||
},
|
||||
{
|
||||
Name: "AddOffset",
|
||||
SchemaName: "add_offset",
|
||||
},
|
||||
{
|
||||
Name: "Limit",
|
||||
SchemaName: "limit",
|
||||
},
|
||||
{
|
||||
Name: "MaxID",
|
||||
SchemaName: "max_id",
|
||||
},
|
||||
{
|
||||
Name: "MinID",
|
||||
SchemaName: "min_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) SetFlags() {
|
||||
if !(g.TopMsgID == 0) {
|
||||
g.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getUnreadPollVotes#43286cf2 as nil")
|
||||
}
|
||||
b.PutID(MessagesGetUnreadPollVotesRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getUnreadPollVotes#43286cf2 as nil")
|
||||
}
|
||||
g.SetFlags()
|
||||
if err := g.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadPollVotes#43286cf2: field flags: %w", err)
|
||||
}
|
||||
if g.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadPollVotes#43286cf2: field peer is nil")
|
||||
}
|
||||
if err := g.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadPollVotes#43286cf2: field peer: %w", err)
|
||||
}
|
||||
if g.Flags.Has(0) {
|
||||
b.PutInt(g.TopMsgID)
|
||||
}
|
||||
b.PutInt(g.OffsetID)
|
||||
b.PutInt(g.AddOffset)
|
||||
b.PutInt(g.Limit)
|
||||
b.PutInt(g.MaxID)
|
||||
b.PutInt(g.MinID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getUnreadPollVotes#43286cf2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesGetUnreadPollVotesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getUnreadPollVotes#43286cf2 to nil")
|
||||
}
|
||||
{
|
||||
if err := g.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field peer: %w", err)
|
||||
}
|
||||
g.Peer = value
|
||||
}
|
||||
if g.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field top_msg_id: %w", err)
|
||||
}
|
||||
g.TopMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field offset_id: %w", err)
|
||||
}
|
||||
g.OffsetID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field add_offset: %w", err)
|
||||
}
|
||||
g.AddOffset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field limit: %w", err)
|
||||
}
|
||||
g.Limit = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field max_id: %w", err)
|
||||
}
|
||||
g.MaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadPollVotes#43286cf2: field min_id: %w", err)
|
||||
}
|
||||
g.MinID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetPeer() (value InputPeerClass) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Peer
|
||||
}
|
||||
|
||||
// SetTopMsgID sets value of TopMsgID conditional field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) SetTopMsgID(value int) {
|
||||
g.Flags.Set(0)
|
||||
g.TopMsgID = value
|
||||
}
|
||||
|
||||
// GetTopMsgID returns value of TopMsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetTopMsgID() (value int, ok bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
if !g.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return g.TopMsgID, true
|
||||
}
|
||||
|
||||
// GetOffsetID returns value of OffsetID field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetOffsetID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.OffsetID
|
||||
}
|
||||
|
||||
// GetAddOffset returns value of AddOffset field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetAddOffset() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.AddOffset
|
||||
}
|
||||
|
||||
// GetLimit returns value of Limit field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetLimit() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Limit
|
||||
}
|
||||
|
||||
// GetMaxID returns value of MaxID field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetMaxID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.MaxID
|
||||
}
|
||||
|
||||
// GetMinID returns value of MinID field.
|
||||
func (g *MessagesGetUnreadPollVotesRequest) GetMinID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.MinID
|
||||
}
|
||||
|
||||
// MessagesGetUnreadPollVotes invokes method messages.getUnreadPollVotes#43286cf2 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getUnreadPollVotes for reference.
|
||||
func (c *Client) MessagesGetUnreadPollVotes(ctx context.Context, request *MessagesGetUnreadPollVotesRequest) (MessagesMessagesClass, error) {
|
||||
var result MessagesMessagesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Messages, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesReadPollVotesRequest represents TL type `messages.readPollVotes#1720b4d8`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.readPollVotes for reference.
|
||||
type MessagesReadPollVotesRequest struct {
|
||||
// Flags field of MessagesReadPollVotesRequest.
|
||||
Flags bin.Fields
|
||||
// Peer field of MessagesReadPollVotesRequest.
|
||||
Peer InputPeerClass
|
||||
// TopMsgID field of MessagesReadPollVotesRequest.
|
||||
//
|
||||
// Use SetTopMsgID and GetTopMsgID helpers.
|
||||
TopMsgID int
|
||||
}
|
||||
|
||||
// MessagesReadPollVotesRequestTypeID is TL type id of MessagesReadPollVotesRequest.
|
||||
const MessagesReadPollVotesRequestTypeID = 0x1720b4d8
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesReadPollVotesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesReadPollVotesRequest{}
|
||||
_ bin.Decoder = &MessagesReadPollVotesRequest{}
|
||||
_ bin.BareEncoder = &MessagesReadPollVotesRequest{}
|
||||
_ bin.BareDecoder = &MessagesReadPollVotesRequest{}
|
||||
)
|
||||
|
||||
func (r *MessagesReadPollVotesRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(r.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.TopMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *MessagesReadPollVotesRequest) String() string {
|
||||
if r == nil {
|
||||
return "MessagesReadPollVotesRequest(nil)"
|
||||
}
|
||||
type Alias MessagesReadPollVotesRequest
|
||||
return fmt.Sprintf("MessagesReadPollVotesRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesReadPollVotesRequest from given interface.
|
||||
func (r *MessagesReadPollVotesRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetTopMsgID() (value int, ok bool)
|
||||
}) {
|
||||
r.Peer = from.GetPeer()
|
||||
if val, ok := from.GetTopMsgID(); ok {
|
||||
r.TopMsgID = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesReadPollVotesRequest) TypeID() uint32 {
|
||||
return MessagesReadPollVotesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesReadPollVotesRequest) TypeName() string {
|
||||
return "messages.readPollVotes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *MessagesReadPollVotesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.readPollVotes",
|
||||
ID: MessagesReadPollVotesRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "TopMsgID",
|
||||
SchemaName: "top_msg_id",
|
||||
Null: !r.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (r *MessagesReadPollVotesRequest) SetFlags() {
|
||||
if !(r.TopMsgID == 0) {
|
||||
r.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *MessagesReadPollVotesRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.readPollVotes#1720b4d8 as nil")
|
||||
}
|
||||
b.PutID(MessagesReadPollVotesRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *MessagesReadPollVotesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.readPollVotes#1720b4d8 as nil")
|
||||
}
|
||||
r.SetFlags()
|
||||
if err := r.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.readPollVotes#1720b4d8: field flags: %w", err)
|
||||
}
|
||||
if r.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.readPollVotes#1720b4d8: field peer is nil")
|
||||
}
|
||||
if err := r.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.readPollVotes#1720b4d8: field peer: %w", err)
|
||||
}
|
||||
if r.Flags.Has(0) {
|
||||
b.PutInt(r.TopMsgID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *MessagesReadPollVotesRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.readPollVotes#1720b4d8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesReadPollVotesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.readPollVotes#1720b4d8: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *MessagesReadPollVotesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.readPollVotes#1720b4d8 to nil")
|
||||
}
|
||||
{
|
||||
if err := r.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.readPollVotes#1720b4d8: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.readPollVotes#1720b4d8: field peer: %w", err)
|
||||
}
|
||||
r.Peer = value
|
||||
}
|
||||
if r.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.readPollVotes#1720b4d8: field top_msg_id: %w", err)
|
||||
}
|
||||
r.TopMsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (r *MessagesReadPollVotesRequest) GetPeer() (value InputPeerClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Peer
|
||||
}
|
||||
|
||||
// SetTopMsgID sets value of TopMsgID conditional field.
|
||||
func (r *MessagesReadPollVotesRequest) SetTopMsgID(value int) {
|
||||
r.Flags.Set(0)
|
||||
r.TopMsgID = value
|
||||
}
|
||||
|
||||
// GetTopMsgID returns value of TopMsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (r *MessagesReadPollVotesRequest) GetTopMsgID() (value int, ok bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if !r.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return r.TopMsgID, true
|
||||
}
|
||||
|
||||
// MessagesReadPollVotes invokes method messages.readPollVotes#1720b4d8 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.readPollVotes for reference.
|
||||
func (c *Client) MessagesReadPollVotes(ctx context.Context, request *MessagesReadPollVotesRequest) (*MessagesAffectedHistory, error) {
|
||||
var result MessagesAffectedHistory
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesReportMusicListenRequest represents TL type `messages.reportMusicListen#ddbcd819`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.reportMusicListen for reference.
|
||||
type MessagesReportMusicListenRequest struct {
|
||||
// ID field of MessagesReportMusicListenRequest.
|
||||
ID InputDocumentClass
|
||||
// ListenedDuration field of MessagesReportMusicListenRequest.
|
||||
ListenedDuration int
|
||||
}
|
||||
|
||||
// MessagesReportMusicListenRequestTypeID is TL type id of MessagesReportMusicListenRequest.
|
||||
const MessagesReportMusicListenRequestTypeID = 0xddbcd819
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesReportMusicListenRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesReportMusicListenRequest{}
|
||||
_ bin.Decoder = &MessagesReportMusicListenRequest{}
|
||||
_ bin.BareEncoder = &MessagesReportMusicListenRequest{}
|
||||
_ bin.BareDecoder = &MessagesReportMusicListenRequest{}
|
||||
)
|
||||
|
||||
func (r *MessagesReportMusicListenRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.ID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.ListenedDuration == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *MessagesReportMusicListenRequest) String() string {
|
||||
if r == nil {
|
||||
return "MessagesReportMusicListenRequest(nil)"
|
||||
}
|
||||
type Alias MessagesReportMusicListenRequest
|
||||
return fmt.Sprintf("MessagesReportMusicListenRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesReportMusicListenRequest from given interface.
|
||||
func (r *MessagesReportMusicListenRequest) FillFrom(from interface {
|
||||
GetID() (value InputDocumentClass)
|
||||
GetListenedDuration() (value int)
|
||||
}) {
|
||||
r.ID = from.GetID()
|
||||
r.ListenedDuration = from.GetListenedDuration()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesReportMusicListenRequest) TypeID() uint32 {
|
||||
return MessagesReportMusicListenRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesReportMusicListenRequest) TypeName() string {
|
||||
return "messages.reportMusicListen"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *MessagesReportMusicListenRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.reportMusicListen",
|
||||
ID: MessagesReportMusicListenRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
},
|
||||
{
|
||||
Name: "ListenedDuration",
|
||||
SchemaName: "listened_duration",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *MessagesReportMusicListenRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.reportMusicListen#ddbcd819 as nil")
|
||||
}
|
||||
b.PutID(MessagesReportMusicListenRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *MessagesReportMusicListenRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.reportMusicListen#ddbcd819 as nil")
|
||||
}
|
||||
if r.ID == nil {
|
||||
return fmt.Errorf("unable to encode messages.reportMusicListen#ddbcd819: field id is nil")
|
||||
}
|
||||
if err := r.ID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.reportMusicListen#ddbcd819: field id: %w", err)
|
||||
}
|
||||
b.PutInt(r.ListenedDuration)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *MessagesReportMusicListenRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.reportMusicListen#ddbcd819 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesReportMusicListenRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportMusicListen#ddbcd819: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *MessagesReportMusicListenRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.reportMusicListen#ddbcd819 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportMusicListen#ddbcd819: field id: %w", err)
|
||||
}
|
||||
r.ID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportMusicListen#ddbcd819: field listened_duration: %w", err)
|
||||
}
|
||||
r.ListenedDuration = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (r *MessagesReportMusicListenRequest) GetID() (value InputDocumentClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ID
|
||||
}
|
||||
|
||||
// GetListenedDuration returns value of ListenedDuration field.
|
||||
func (r *MessagesReportMusicListenRequest) GetListenedDuration() (value int) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ListenedDuration
|
||||
}
|
||||
|
||||
// GetIDAsNotEmpty returns mapped value of ID field.
|
||||
func (r *MessagesReportMusicListenRequest) GetIDAsNotEmpty() (*InputDocument, bool) {
|
||||
return r.ID.AsNotEmpty()
|
||||
}
|
||||
|
||||
// MessagesReportMusicListen invokes method messages.reportMusicListen#ddbcd819 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.reportMusicListen for reference.
|
||||
func (c *Client) MessagesReportMusicListen(ctx context.Context, request *MessagesReportMusicListenRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesReportReadMetricsRequest represents TL type `messages.reportReadMetrics#4067c5e6`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.reportReadMetrics for reference.
|
||||
type MessagesReportReadMetricsRequest struct {
|
||||
// Peer field of MessagesReportReadMetricsRequest.
|
||||
Peer InputPeerClass
|
||||
// Metrics field of MessagesReportReadMetricsRequest.
|
||||
Metrics []InputMessageReadMetric
|
||||
}
|
||||
|
||||
// MessagesReportReadMetricsRequestTypeID is TL type id of MessagesReportReadMetricsRequest.
|
||||
const MessagesReportReadMetricsRequestTypeID = 0x4067c5e6
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesReportReadMetricsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesReportReadMetricsRequest{}
|
||||
_ bin.Decoder = &MessagesReportReadMetricsRequest{}
|
||||
_ bin.BareEncoder = &MessagesReportReadMetricsRequest{}
|
||||
_ bin.BareDecoder = &MessagesReportReadMetricsRequest{}
|
||||
)
|
||||
|
||||
func (r *MessagesReportReadMetricsRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.Metrics == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *MessagesReportReadMetricsRequest) String() string {
|
||||
if r == nil {
|
||||
return "MessagesReportReadMetricsRequest(nil)"
|
||||
}
|
||||
type Alias MessagesReportReadMetricsRequest
|
||||
return fmt.Sprintf("MessagesReportReadMetricsRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesReportReadMetricsRequest from given interface.
|
||||
func (r *MessagesReportReadMetricsRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMetrics() (value []InputMessageReadMetric)
|
||||
}) {
|
||||
r.Peer = from.GetPeer()
|
||||
r.Metrics = from.GetMetrics()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesReportReadMetricsRequest) TypeID() uint32 {
|
||||
return MessagesReportReadMetricsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesReportReadMetricsRequest) TypeName() string {
|
||||
return "messages.reportReadMetrics"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *MessagesReportReadMetricsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.reportReadMetrics",
|
||||
ID: MessagesReportReadMetricsRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "Metrics",
|
||||
SchemaName: "metrics",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *MessagesReportReadMetricsRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.reportReadMetrics#4067c5e6 as nil")
|
||||
}
|
||||
b.PutID(MessagesReportReadMetricsRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *MessagesReportReadMetricsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.reportReadMetrics#4067c5e6 as nil")
|
||||
}
|
||||
if r.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.reportReadMetrics#4067c5e6: field peer is nil")
|
||||
}
|
||||
if err := r.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.reportReadMetrics#4067c5e6: field peer: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(r.Metrics))
|
||||
for idx, v := range r.Metrics {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.reportReadMetrics#4067c5e6: field metrics element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *MessagesReportReadMetricsRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.reportReadMetrics#4067c5e6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesReportReadMetricsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportReadMetrics#4067c5e6: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *MessagesReportReadMetricsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.reportReadMetrics#4067c5e6 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportReadMetrics#4067c5e6: field peer: %w", err)
|
||||
}
|
||||
r.Peer = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportReadMetrics#4067c5e6: field metrics: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
r.Metrics = make([]InputMessageReadMetric, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value InputMessageReadMetric
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.reportReadMetrics#4067c5e6: field metrics: %w", err)
|
||||
}
|
||||
r.Metrics = append(r.Metrics, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (r *MessagesReportReadMetricsRequest) GetPeer() (value InputPeerClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Peer
|
||||
}
|
||||
|
||||
// GetMetrics returns value of Metrics field.
|
||||
func (r *MessagesReportReadMetricsRequest) GetMetrics() (value []InputMessageReadMetric) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Metrics
|
||||
}
|
||||
|
||||
// MessagesReportReadMetrics invokes method messages.reportReadMetrics#4067c5e6 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.reportReadMetrics for reference.
|
||||
func (c *Client) MessagesReportReadMetrics(ctx context.Context, request *MessagesReportReadMetricsRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
+111
-24
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesSendBotRequestedPeerRequest represents TL type `messages.sendBotRequestedPeer#91b2d060`.
|
||||
// MessagesSendBotRequestedPeerRequest represents TL type `messages.sendBotRequestedPeer#6c5cf2a7`.
|
||||
// Send one or more chosen peers, as requested by a keyboardButtonRequestPeer¹ button.
|
||||
//
|
||||
// Links:
|
||||
@@ -39,6 +39,8 @@ var (
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.sendBotRequestedPeer for reference.
|
||||
type MessagesSendBotRequestedPeerRequest struct {
|
||||
// Flags field of MessagesSendBotRequestedPeerRequest.
|
||||
Flags bin.Fields
|
||||
// The bot that sent the keyboardButtonRequestPeer¹ button.
|
||||
//
|
||||
// Links:
|
||||
@@ -49,7 +51,13 @@ type MessagesSendBotRequestedPeerRequest struct {
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/constructor/keyboardButtonRequestPeer
|
||||
//
|
||||
// Use SetMsgID and GetMsgID helpers.
|
||||
MsgID int
|
||||
// WebappReqID field of MessagesSendBotRequestedPeerRequest.
|
||||
//
|
||||
// Use SetWebappReqID and GetWebappReqID helpers.
|
||||
WebappReqID string
|
||||
// The button_id field from the keyboardButtonRequestPeer¹ constructor.
|
||||
//
|
||||
// Links:
|
||||
@@ -60,7 +68,7 @@ type MessagesSendBotRequestedPeerRequest struct {
|
||||
}
|
||||
|
||||
// MessagesSendBotRequestedPeerRequestTypeID is TL type id of MessagesSendBotRequestedPeerRequest.
|
||||
const MessagesSendBotRequestedPeerRequestTypeID = 0x91b2d060
|
||||
const MessagesSendBotRequestedPeerRequestTypeID = 0x6c5cf2a7
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesSendBotRequestedPeerRequest.
|
||||
var (
|
||||
@@ -74,12 +82,18 @@ func (s *MessagesSendBotRequestedPeerRequest) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.WebappReqID == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.ButtonID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -102,12 +116,20 @@ func (s *MessagesSendBotRequestedPeerRequest) String() string {
|
||||
// FillFrom fills MessagesSendBotRequestedPeerRequest from given interface.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
GetMsgID() (value int, ok bool)
|
||||
GetWebappReqID() (value string, ok bool)
|
||||
GetButtonID() (value int)
|
||||
GetRequestedPeers() (value []InputPeerClass)
|
||||
}) {
|
||||
s.Peer = from.GetPeer()
|
||||
s.MsgID = from.GetMsgID()
|
||||
if val, ok := from.GetMsgID(); ok {
|
||||
s.MsgID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetWebappReqID(); ok {
|
||||
s.WebappReqID = val
|
||||
}
|
||||
|
||||
s.ButtonID = from.GetButtonID()
|
||||
s.RequestedPeers = from.GetRequestedPeers()
|
||||
}
|
||||
@@ -142,6 +164,12 @@ func (s *MessagesSendBotRequestedPeerRequest) TypeInfo() tdp.Type {
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "WebappReqID",
|
||||
SchemaName: "webapp_req_id",
|
||||
Null: !s.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "ButtonID",
|
||||
@@ -155,10 +183,20 @@ func (s *MessagesSendBotRequestedPeerRequest) TypeInfo() tdp.Type {
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) SetFlags() {
|
||||
if !(s.MsgID == 0) {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
if !(s.WebappReqID == "") {
|
||||
s.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.sendBotRequestedPeer#91b2d060 as nil")
|
||||
return fmt.Errorf("can't encode messages.sendBotRequestedPeer#6c5cf2a7 as nil")
|
||||
}
|
||||
b.PutID(MessagesSendBotRequestedPeerRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -167,23 +205,32 @@ func (s *MessagesSendBotRequestedPeerRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.sendBotRequestedPeer#91b2d060 as nil")
|
||||
return fmt.Errorf("can't encode messages.sendBotRequestedPeer#6c5cf2a7 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#6c5cf2a7: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#6c5cf2a7: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#6c5cf2a7: field peer: %w", err)
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
b.PutInt(s.MsgID)
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
b.PutString(s.WebappReqID)
|
||||
}
|
||||
b.PutInt(s.MsgID)
|
||||
b.PutInt(s.ButtonID)
|
||||
b.PutVectorHeader(len(s.RequestedPeers))
|
||||
for idx, v := range s.RequestedPeers {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#6c5cf2a7: field requested_peers element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#6c5cf2a7: field requested_peers element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -192,10 +239,10 @@ func (s *MessagesSendBotRequestedPeerRequest) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.sendBotRequestedPeer#91b2d060 to nil")
|
||||
return fmt.Errorf("can't decode messages.sendBotRequestedPeer#6c5cf2a7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesSendBotRequestedPeerRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -203,33 +250,45 @@ func (s *MessagesSendBotRequestedPeerRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.sendBotRequestedPeer#91b2d060 to nil")
|
||||
return fmt.Errorf("can't decode messages.sendBotRequestedPeer#6c5cf2a7 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field msg_id: %w", err)
|
||||
}
|
||||
s.MsgID = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field webapp_req_id: %w", err)
|
||||
}
|
||||
s.WebappReqID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field button_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field button_id: %w", err)
|
||||
}
|
||||
s.ButtonID = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field requested_peers: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -238,7 +297,7 @@ func (s *MessagesSendBotRequestedPeerRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#6c5cf2a7: field requested_peers: %w", err)
|
||||
}
|
||||
s.RequestedPeers = append(s.RequestedPeers, value)
|
||||
}
|
||||
@@ -254,12 +313,40 @@ func (s *MessagesSendBotRequestedPeerRequest) GetPeer() (value InputPeerClass) {
|
||||
return s.Peer
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) GetMsgID() (value int) {
|
||||
// SetMsgID sets value of MsgID conditional field.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) SetMsgID(value int) {
|
||||
s.Flags.Set(0)
|
||||
s.MsgID = value
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) GetMsgID() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.MsgID
|
||||
if !s.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return s.MsgID, true
|
||||
}
|
||||
|
||||
// SetWebappReqID sets value of WebappReqID conditional field.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) SetWebappReqID(value string) {
|
||||
s.Flags.Set(1)
|
||||
s.WebappReqID = value
|
||||
}
|
||||
|
||||
// GetWebappReqID returns value of WebappReqID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *MessagesSendBotRequestedPeerRequest) GetWebappReqID() (value string, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return s.WebappReqID, true
|
||||
}
|
||||
|
||||
// GetButtonID returns value of ButtonID field.
|
||||
@@ -283,7 +370,7 @@ func (s *MessagesSendBotRequestedPeerRequest) MapRequestedPeers() (value InputPe
|
||||
return InputPeerClassArray(s.RequestedPeers)
|
||||
}
|
||||
|
||||
// MessagesSendBotRequestedPeer invokes method messages.sendBotRequestedPeer#91b2d060 returning error if any.
|
||||
// MessagesSendBotRequestedPeer invokes method messages.sendBotRequestedPeer#6c5cf2a7 returning error if any.
|
||||
// Send one or more chosen peers, as requested by a keyboardButtonRequestPeer¹ button.
|
||||
//
|
||||
// Links:
|
||||
|
||||
+63
-15
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesSummarizeTextRequest represents TL type `messages.summarizeText#9d4104e2`.
|
||||
// MessagesSummarizeTextRequest represents TL type `messages.summarizeText#abbbd346`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.summarizeText for reference.
|
||||
type MessagesSummarizeTextRequest struct {
|
||||
@@ -45,10 +45,14 @@ type MessagesSummarizeTextRequest struct {
|
||||
//
|
||||
// Use SetToLang and GetToLang helpers.
|
||||
ToLang string
|
||||
// Tone field of MessagesSummarizeTextRequest.
|
||||
//
|
||||
// Use SetTone and GetTone helpers.
|
||||
Tone string
|
||||
}
|
||||
|
||||
// MessagesSummarizeTextRequestTypeID is TL type id of MessagesSummarizeTextRequest.
|
||||
const MessagesSummarizeTextRequestTypeID = 0x9d4104e2
|
||||
const MessagesSummarizeTextRequestTypeID = 0xabbbd346
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesSummarizeTextRequest.
|
||||
var (
|
||||
@@ -74,6 +78,9 @@ func (s *MessagesSummarizeTextRequest) Zero() bool {
|
||||
if !(s.ToLang == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.Tone == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -92,6 +99,7 @@ func (s *MessagesSummarizeTextRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetID() (value int)
|
||||
GetToLang() (value string, ok bool)
|
||||
GetTone() (value string, ok bool)
|
||||
}) {
|
||||
s.Peer = from.GetPeer()
|
||||
s.ID = from.GetID()
|
||||
@@ -99,6 +107,10 @@ func (s *MessagesSummarizeTextRequest) FillFrom(from interface {
|
||||
s.ToLang = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetTone(); ok {
|
||||
s.Tone = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -137,6 +149,11 @@ func (s *MessagesSummarizeTextRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "to_lang",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Tone",
|
||||
SchemaName: "tone",
|
||||
Null: !s.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -146,12 +163,15 @@ func (s *MessagesSummarizeTextRequest) SetFlags() {
|
||||
if !(s.ToLang == "") {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
if !(s.Tone == "") {
|
||||
s.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *MessagesSummarizeTextRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil")
|
||||
return fmt.Errorf("can't encode messages.summarizeText#abbbd346 as nil")
|
||||
}
|
||||
b.PutID(MessagesSummarizeTextRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -160,32 +180,35 @@ func (s *MessagesSummarizeTextRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *MessagesSummarizeTextRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil")
|
||||
return fmt.Errorf("can't encode messages.summarizeText#abbbd346 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#abbbd346: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#abbbd346: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#abbbd346: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(s.ID)
|
||||
if s.Flags.Has(0) {
|
||||
b.PutString(s.ToLang)
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
b.PutString(s.Tone)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *MessagesSummarizeTextRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil")
|
||||
return fmt.Errorf("can't decode messages.summarizeText#abbbd346 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesSummarizeTextRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -193,34 +216,41 @@ func (s *MessagesSummarizeTextRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *MessagesSummarizeTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil")
|
||||
return fmt.Errorf("can't decode messages.summarizeText#abbbd346 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: field id: %w", err)
|
||||
}
|
||||
s.ID = value
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field to_lang: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: field to_lang: %w", err)
|
||||
}
|
||||
s.ToLang = value
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#abbbd346: field tone: %w", err)
|
||||
}
|
||||
s.Tone = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -258,7 +288,25 @@ func (s *MessagesSummarizeTextRequest) GetToLang() (value string, ok bool) {
|
||||
return s.ToLang, true
|
||||
}
|
||||
|
||||
// MessagesSummarizeText invokes method messages.summarizeText#9d4104e2 returning error if any.
|
||||
// SetTone sets value of Tone conditional field.
|
||||
func (s *MessagesSummarizeTextRequest) SetTone(value string) {
|
||||
s.Flags.Set(2)
|
||||
s.Tone = value
|
||||
}
|
||||
|
||||
// GetTone returns value of Tone conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *MessagesSummarizeTextRequest) GetTone() (value string, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return s.Tone, true
|
||||
}
|
||||
|
||||
// MessagesSummarizeText invokes method messages.summarizeText#abbbd346 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.summarizeText for reference.
|
||||
func (c *Client) MessagesSummarizeText(ctx context.Context, request *MessagesSummarizeTextRequest) (*TextWithEntities, error) {
|
||||
|
||||
+67
-19
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesTranslateTextRequest represents TL type `messages.translateText#63183030`.
|
||||
// MessagesTranslateTextRequest represents TL type `messages.translateText#a5eec345`.
|
||||
// Translate a given text.
|
||||
// Styled text entities¹ will only be preserved for Telegram Premium² users.
|
||||
//
|
||||
@@ -60,10 +60,14 @@ type MessagesTranslateTextRequest struct {
|
||||
Text []TextWithEntities
|
||||
// Two-letter ISO 639-1 language code of the language to which the message is translated
|
||||
ToLang string
|
||||
// Tone field of MessagesTranslateTextRequest.
|
||||
//
|
||||
// Use SetTone and GetTone helpers.
|
||||
Tone string
|
||||
}
|
||||
|
||||
// MessagesTranslateTextRequestTypeID is TL type id of MessagesTranslateTextRequest.
|
||||
const MessagesTranslateTextRequestTypeID = 0x63183030
|
||||
const MessagesTranslateTextRequestTypeID = 0xa5eec345
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesTranslateTextRequest.
|
||||
var (
|
||||
@@ -92,6 +96,9 @@ func (t *MessagesTranslateTextRequest) Zero() bool {
|
||||
if !(t.ToLang == "") {
|
||||
return false
|
||||
}
|
||||
if !(t.Tone == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -111,6 +118,7 @@ func (t *MessagesTranslateTextRequest) FillFrom(from interface {
|
||||
GetID() (value []int, ok bool)
|
||||
GetText() (value []TextWithEntities, ok bool)
|
||||
GetToLang() (value string)
|
||||
GetTone() (value string, ok bool)
|
||||
}) {
|
||||
if val, ok := from.GetPeer(); ok {
|
||||
t.Peer = val
|
||||
@@ -125,6 +133,10 @@ func (t *MessagesTranslateTextRequest) FillFrom(from interface {
|
||||
}
|
||||
|
||||
t.ToLang = from.GetToLang()
|
||||
if val, ok := from.GetTone(); ok {
|
||||
t.Tone = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -169,6 +181,11 @@ func (t *MessagesTranslateTextRequest) TypeInfo() tdp.Type {
|
||||
Name: "ToLang",
|
||||
SchemaName: "to_lang",
|
||||
},
|
||||
{
|
||||
Name: "Tone",
|
||||
SchemaName: "tone",
|
||||
Null: !t.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -184,12 +201,15 @@ func (t *MessagesTranslateTextRequest) SetFlags() {
|
||||
if !(t.Text == nil) {
|
||||
t.Flags.Set(1)
|
||||
}
|
||||
if !(t.Tone == "") {
|
||||
t.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *MessagesTranslateTextRequest) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.translateText#63183030 as nil")
|
||||
return fmt.Errorf("can't encode messages.translateText#a5eec345 as nil")
|
||||
}
|
||||
b.PutID(MessagesTranslateTextRequestTypeID)
|
||||
return t.EncodeBare(b)
|
||||
@@ -198,18 +218,18 @@ func (t *MessagesTranslateTextRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *MessagesTranslateTextRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.translateText#63183030 as nil")
|
||||
return fmt.Errorf("can't encode messages.translateText#a5eec345 as nil")
|
||||
}
|
||||
t.SetFlags()
|
||||
if err := t.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.translateText#63183030: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.translateText#a5eec345: field flags: %w", err)
|
||||
}
|
||||
if t.Flags.Has(0) {
|
||||
if t.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.translateText#63183030: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.translateText#a5eec345: field peer is nil")
|
||||
}
|
||||
if err := t.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.translateText#63183030: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.translateText#a5eec345: field peer: %w", err)
|
||||
}
|
||||
}
|
||||
if t.Flags.Has(0) {
|
||||
@@ -222,21 +242,24 @@ func (t *MessagesTranslateTextRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(t.Text))
|
||||
for idx, v := range t.Text {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.translateText#63183030: field text element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode messages.translateText#a5eec345: field text element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
b.PutString(t.ToLang)
|
||||
if t.Flags.Has(2) {
|
||||
b.PutString(t.Tone)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *MessagesTranslateTextRequest) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.translateText#63183030 to nil")
|
||||
return fmt.Errorf("can't decode messages.translateText#a5eec345 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesTranslateTextRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
@@ -244,24 +267,24 @@ func (t *MessagesTranslateTextRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *MessagesTranslateTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.translateText#63183030 to nil")
|
||||
return fmt.Errorf("can't decode messages.translateText#a5eec345 to nil")
|
||||
}
|
||||
{
|
||||
if err := t.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
if t.Flags.Has(0) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field peer: %w", err)
|
||||
}
|
||||
t.Peer = value
|
||||
}
|
||||
if t.Flags.Has(0) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field id: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -270,7 +293,7 @@ func (t *MessagesTranslateTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field id: %w", err)
|
||||
}
|
||||
t.ID = append(t.ID, value)
|
||||
}
|
||||
@@ -278,7 +301,7 @@ func (t *MessagesTranslateTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if t.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field text: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field text: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -287,7 +310,7 @@ func (t *MessagesTranslateTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value TextWithEntities
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field text: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field text: %w", err)
|
||||
}
|
||||
t.Text = append(t.Text, value)
|
||||
}
|
||||
@@ -295,10 +318,17 @@ func (t *MessagesTranslateTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#63183030: field to_lang: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field to_lang: %w", err)
|
||||
}
|
||||
t.ToLang = value
|
||||
}
|
||||
if t.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.translateText#a5eec345: field tone: %w", err)
|
||||
}
|
||||
t.Tone = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -364,7 +394,25 @@ func (t *MessagesTranslateTextRequest) GetToLang() (value string) {
|
||||
return t.ToLang
|
||||
}
|
||||
|
||||
// MessagesTranslateText invokes method messages.translateText#63183030 returning error if any.
|
||||
// SetTone sets value of Tone conditional field.
|
||||
func (t *MessagesTranslateTextRequest) SetTone(value string) {
|
||||
t.Flags.Set(2)
|
||||
t.Tone = value
|
||||
}
|
||||
|
||||
// GetTone returns value of Tone conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (t *MessagesTranslateTextRequest) GetTone() (value string, ok bool) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
if !t.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return t.Tone, true
|
||||
}
|
||||
|
||||
// MessagesTranslateText invokes method messages.translateText#a5eec345 returning error if any.
|
||||
// Translate a given text.
|
||||
// Styled text entities¹ will only be preserved for Telegram Premium² users.
|
||||
//
|
||||
|
||||
@@ -56,6 +56,8 @@ type PaymentsGetResaleStarGiftsRequest struct {
|
||||
SortByNum bool
|
||||
// ForCraft field of PaymentsGetResaleStarGiftsRequest.
|
||||
ForCraft bool
|
||||
// StarsOnly field of PaymentsGetResaleStarGiftsRequest.
|
||||
StarsOnly bool
|
||||
// If a previous call to the method was made and payments.resaleStarGifts¹
|
||||
// attributes_hash was set, pass it here to avoid returning any results if they haven't
|
||||
// changed. Otherwise, set this flag and pass 0 to return payments.resaleStarGifts²
|
||||
@@ -117,6 +119,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) Zero() bool {
|
||||
if !(g.ForCraft == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.StarsOnly == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.AttributesHash == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -150,6 +155,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface {
|
||||
GetSortByPrice() (value bool)
|
||||
GetSortByNum() (value bool)
|
||||
GetForCraft() (value bool)
|
||||
GetStarsOnly() (value bool)
|
||||
GetAttributesHash() (value int64, ok bool)
|
||||
GetGiftID() (value int64)
|
||||
GetAttributes() (value []StarGiftAttributeIDClass, ok bool)
|
||||
@@ -159,6 +165,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface {
|
||||
g.SortByPrice = from.GetSortByPrice()
|
||||
g.SortByNum = from.GetSortByNum()
|
||||
g.ForCraft = from.GetForCraft()
|
||||
g.StarsOnly = from.GetStarsOnly()
|
||||
if val, ok := from.GetAttributesHash(); ok {
|
||||
g.AttributesHash = val
|
||||
}
|
||||
@@ -210,6 +217,11 @@ func (g *PaymentsGetResaleStarGiftsRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "for_craft",
|
||||
Null: !g.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "StarsOnly",
|
||||
SchemaName: "stars_only",
|
||||
Null: !g.Flags.Has(5),
|
||||
},
|
||||
{
|
||||
Name: "AttributesHash",
|
||||
SchemaName: "attributes_hash",
|
||||
@@ -247,6 +259,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) SetFlags() {
|
||||
if !(g.ForCraft == false) {
|
||||
g.Flags.Set(4)
|
||||
}
|
||||
if !(g.StarsOnly == false) {
|
||||
g.Flags.Set(5)
|
||||
}
|
||||
if !(g.AttributesHash == 0) {
|
||||
g.Flags.Set(0)
|
||||
}
|
||||
@@ -317,6 +332,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
g.SortByPrice = g.Flags.Has(1)
|
||||
g.SortByNum = g.Flags.Has(2)
|
||||
g.ForCraft = g.Flags.Has(4)
|
||||
g.StarsOnly = g.Flags.Has(5)
|
||||
if g.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
@@ -422,6 +438,25 @@ func (g *PaymentsGetResaleStarGiftsRequest) GetForCraft() (value bool) {
|
||||
return g.Flags.Has(4)
|
||||
}
|
||||
|
||||
// SetStarsOnly sets value of StarsOnly conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) SetStarsOnly(value bool) {
|
||||
if value {
|
||||
g.Flags.Set(5)
|
||||
g.StarsOnly = true
|
||||
} else {
|
||||
g.Flags.Unset(5)
|
||||
g.StarsOnly = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetStarsOnly returns value of StarsOnly conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) GetStarsOnly() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Flags.Has(5)
|
||||
}
|
||||
|
||||
// SetAttributesHash sets value of AttributesHash conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) SetAttributesHash(value int64) {
|
||||
g.Flags.Set(0)
|
||||
|
||||
Generated
+489
-10
@@ -31,11 +31,13 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// PollAnswer represents TL type `pollAnswer#ff16e2ca`.
|
||||
// PollAnswer represents TL type `pollAnswer#4b7d786a`.
|
||||
// A possible answer of a poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/pollAnswer for reference.
|
||||
type PollAnswer struct {
|
||||
// Flags field of PollAnswer.
|
||||
Flags bin.Fields
|
||||
// Textual representation of the answer (only Premium¹ users can use custom emoji
|
||||
// entities² here).
|
||||
//
|
||||
@@ -48,10 +50,25 @@ type PollAnswer struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/method/messages.sendVote
|
||||
Option []byte
|
||||
// Media field of PollAnswer.
|
||||
//
|
||||
// Use SetMedia and GetMedia helpers.
|
||||
Media MessageMediaClass
|
||||
// AddedBy field of PollAnswer.
|
||||
//
|
||||
// Use SetAddedBy and GetAddedBy helpers.
|
||||
AddedBy PeerClass
|
||||
// Date field of PollAnswer.
|
||||
//
|
||||
// Use SetDate and GetDate helpers.
|
||||
Date int
|
||||
}
|
||||
|
||||
// PollAnswerTypeID is TL type id of PollAnswer.
|
||||
const PollAnswerTypeID = 0xff16e2ca
|
||||
const PollAnswerTypeID = 0x4b7d786a
|
||||
|
||||
// construct implements constructor of PollAnswerClass.
|
||||
func (p PollAnswer) construct() PollAnswerClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PollAnswer.
|
||||
var (
|
||||
@@ -59,18 +76,32 @@ var (
|
||||
_ bin.Decoder = &PollAnswer{}
|
||||
_ bin.BareEncoder = &PollAnswer{}
|
||||
_ bin.BareDecoder = &PollAnswer{}
|
||||
|
||||
_ PollAnswerClass = &PollAnswer{}
|
||||
)
|
||||
|
||||
func (p *PollAnswer) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(p.Text.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(p.Option == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Media == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.AddedBy == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Date == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -88,9 +119,24 @@ func (p *PollAnswer) String() string {
|
||||
func (p *PollAnswer) FillFrom(from interface {
|
||||
GetText() (value TextWithEntities)
|
||||
GetOption() (value []byte)
|
||||
GetMedia() (value MessageMediaClass, ok bool)
|
||||
GetAddedBy() (value PeerClass, ok bool)
|
||||
GetDate() (value int, ok bool)
|
||||
}) {
|
||||
p.Text = from.GetText()
|
||||
p.Option = from.GetOption()
|
||||
if val, ok := from.GetMedia(); ok {
|
||||
p.Media = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetAddedBy(); ok {
|
||||
p.AddedBy = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetDate(); ok {
|
||||
p.Date = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -124,14 +170,42 @@ func (p *PollAnswer) TypeInfo() tdp.Type {
|
||||
Name: "Option",
|
||||
SchemaName: "option",
|
||||
},
|
||||
{
|
||||
Name: "Media",
|
||||
SchemaName: "media",
|
||||
Null: !p.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "AddedBy",
|
||||
SchemaName: "added_by",
|
||||
Null: !p.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "Date",
|
||||
SchemaName: "date",
|
||||
Null: !p.Flags.Has(1),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (p *PollAnswer) SetFlags() {
|
||||
if !(p.Media == nil) {
|
||||
p.Flags.Set(0)
|
||||
}
|
||||
if !(p.AddedBy == nil) {
|
||||
p.Flags.Set(1)
|
||||
}
|
||||
if !(p.Date == 0) {
|
||||
p.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PollAnswer) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollAnswer#ff16e2ca as nil")
|
||||
return fmt.Errorf("can't encode pollAnswer#4b7d786a as nil")
|
||||
}
|
||||
b.PutID(PollAnswerTypeID)
|
||||
return p.EncodeBare(b)
|
||||
@@ -140,22 +214,45 @@ func (p *PollAnswer) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PollAnswer) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollAnswer#ff16e2ca as nil")
|
||||
return fmt.Errorf("can't encode pollAnswer#4b7d786a as nil")
|
||||
}
|
||||
p.SetFlags()
|
||||
if err := p.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field flags: %w", err)
|
||||
}
|
||||
if err := p.Text.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#ff16e2ca: field text: %w", err)
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field text: %w", err)
|
||||
}
|
||||
b.PutBytes(p.Option)
|
||||
if p.Flags.Has(0) {
|
||||
if p.Media == nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field media is nil")
|
||||
}
|
||||
if err := p.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field media: %w", err)
|
||||
}
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
if p.AddedBy == nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field added_by is nil")
|
||||
}
|
||||
if err := p.AddedBy.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswer#4b7d786a: field added_by: %w", err)
|
||||
}
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
b.PutInt(p.Date)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PollAnswer) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollAnswer#ff16e2ca to nil")
|
||||
return fmt.Errorf("can't decode pollAnswer#4b7d786a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PollAnswerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#ff16e2ca: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
@@ -163,20 +260,46 @@ func (p *PollAnswer) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PollAnswer) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollAnswer#ff16e2ca to nil")
|
||||
return fmt.Errorf("can't decode pollAnswer#4b7d786a to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := p.Text.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#ff16e2ca: field text: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field text: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#ff16e2ca: field option: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field option: %w", err)
|
||||
}
|
||||
p.Option = value
|
||||
}
|
||||
if p.Flags.Has(0) {
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field media: %w", err)
|
||||
}
|
||||
p.Media = value
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field added_by: %w", err)
|
||||
}
|
||||
p.AddedBy = value
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswer#4b7d786a: field date: %w", err)
|
||||
}
|
||||
p.Date = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -195,3 +318,359 @@ func (p *PollAnswer) GetOption() (value []byte) {
|
||||
}
|
||||
return p.Option
|
||||
}
|
||||
|
||||
// SetMedia sets value of Media conditional field.
|
||||
func (p *PollAnswer) SetMedia(value MessageMediaClass) {
|
||||
p.Flags.Set(0)
|
||||
p.Media = value
|
||||
}
|
||||
|
||||
// GetMedia returns value of Media conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollAnswer) GetMedia() (value MessageMediaClass, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return p.Media, true
|
||||
}
|
||||
|
||||
// SetAddedBy sets value of AddedBy conditional field.
|
||||
func (p *PollAnswer) SetAddedBy(value PeerClass) {
|
||||
p.Flags.Set(1)
|
||||
p.AddedBy = value
|
||||
}
|
||||
|
||||
// GetAddedBy returns value of AddedBy conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollAnswer) GetAddedBy() (value PeerClass, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return p.AddedBy, true
|
||||
}
|
||||
|
||||
// SetDate sets value of Date conditional field.
|
||||
func (p *PollAnswer) SetDate(value int) {
|
||||
p.Flags.Set(1)
|
||||
p.Date = value
|
||||
}
|
||||
|
||||
// GetDate returns value of Date conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollAnswer) GetDate() (value int, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return p.Date, true
|
||||
}
|
||||
|
||||
// InputPollAnswer represents TL type `inputPollAnswer#199fed96`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputPollAnswer for reference.
|
||||
type InputPollAnswer struct {
|
||||
// Flags field of InputPollAnswer.
|
||||
Flags bin.Fields
|
||||
// Text field of InputPollAnswer.
|
||||
Text TextWithEntities
|
||||
// Media field of InputPollAnswer.
|
||||
//
|
||||
// Use SetMedia and GetMedia helpers.
|
||||
Media InputMediaClass
|
||||
}
|
||||
|
||||
// InputPollAnswerTypeID is TL type id of InputPollAnswer.
|
||||
const InputPollAnswerTypeID = 0x199fed96
|
||||
|
||||
// construct implements constructor of PollAnswerClass.
|
||||
func (i InputPollAnswer) construct() PollAnswerClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputPollAnswer.
|
||||
var (
|
||||
_ bin.Encoder = &InputPollAnswer{}
|
||||
_ bin.Decoder = &InputPollAnswer{}
|
||||
_ bin.BareEncoder = &InputPollAnswer{}
|
||||
_ bin.BareDecoder = &InputPollAnswer{}
|
||||
|
||||
_ PollAnswerClass = &InputPollAnswer{}
|
||||
)
|
||||
|
||||
func (i *InputPollAnswer) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(i.Text.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(i.Media == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputPollAnswer) String() string {
|
||||
if i == nil {
|
||||
return "InputPollAnswer(nil)"
|
||||
}
|
||||
type Alias InputPollAnswer
|
||||
return fmt.Sprintf("InputPollAnswer%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputPollAnswer from given interface.
|
||||
func (i *InputPollAnswer) FillFrom(from interface {
|
||||
GetText() (value TextWithEntities)
|
||||
GetMedia() (value InputMediaClass, ok bool)
|
||||
}) {
|
||||
i.Text = from.GetText()
|
||||
if val, ok := from.GetMedia(); ok {
|
||||
i.Media = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputPollAnswer) TypeID() uint32 {
|
||||
return InputPollAnswerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputPollAnswer) TypeName() string {
|
||||
return "inputPollAnswer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputPollAnswer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputPollAnswer",
|
||||
ID: InputPollAnswerTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Text",
|
||||
SchemaName: "text",
|
||||
},
|
||||
{
|
||||
Name: "Media",
|
||||
SchemaName: "media",
|
||||
Null: !i.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (i *InputPollAnswer) SetFlags() {
|
||||
if !(i.Media == nil) {
|
||||
i.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputPollAnswer) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPollAnswer#199fed96 as nil")
|
||||
}
|
||||
b.PutID(InputPollAnswerTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputPollAnswer) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPollAnswer#199fed96 as nil")
|
||||
}
|
||||
i.SetFlags()
|
||||
if err := i.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPollAnswer#199fed96: field flags: %w", err)
|
||||
}
|
||||
if err := i.Text.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPollAnswer#199fed96: field text: %w", err)
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
if i.Media == nil {
|
||||
return fmt.Errorf("unable to encode inputPollAnswer#199fed96: field media is nil")
|
||||
}
|
||||
if err := i.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPollAnswer#199fed96: field media: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputPollAnswer) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPollAnswer#199fed96 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputPollAnswerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPollAnswer#199fed96: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputPollAnswer) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPollAnswer#199fed96 to nil")
|
||||
}
|
||||
{
|
||||
if err := i.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPollAnswer#199fed96: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := i.Text.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPollAnswer#199fed96: field text: %w", err)
|
||||
}
|
||||
}
|
||||
if i.Flags.Has(0) {
|
||||
value, err := DecodeInputMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPollAnswer#199fed96: field media: %w", err)
|
||||
}
|
||||
i.Media = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetText returns value of Text field.
|
||||
func (i *InputPollAnswer) GetText() (value TextWithEntities) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Text
|
||||
}
|
||||
|
||||
// SetMedia sets value of Media conditional field.
|
||||
func (i *InputPollAnswer) SetMedia(value InputMediaClass) {
|
||||
i.Flags.Set(0)
|
||||
i.Media = value
|
||||
}
|
||||
|
||||
// GetMedia returns value of Media conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (i *InputPollAnswer) GetMedia() (value InputMediaClass, ok bool) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
if !i.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return i.Media, true
|
||||
}
|
||||
|
||||
// PollAnswerClassName is schema name of PollAnswerClass.
|
||||
const PollAnswerClassName = "PollAnswer"
|
||||
|
||||
// PollAnswerClass represents PollAnswer generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/PollAnswer for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodePollAnswer(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.PollAnswer: // pollAnswer#4b7d786a
|
||||
// case *tg.InputPollAnswer: // inputPollAnswer#199fed96
|
||||
// default: panic(v)
|
||||
// }
|
||||
type PollAnswerClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() PollAnswerClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// Textual representation of the answer (only Premium¹ users can use custom emoji
|
||||
// entities² here).
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/premium
|
||||
// 2) https://core.telegram.org/api/custom-emoji
|
||||
GetText() (value TextWithEntities)
|
||||
}
|
||||
|
||||
// DecodePollAnswer implements binary de-serialization for PollAnswerClass.
|
||||
func DecodePollAnswer(buf *bin.Buffer) (PollAnswerClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case PollAnswerTypeID:
|
||||
// Decoding pollAnswer#4b7d786a.
|
||||
v := PollAnswer{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PollAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputPollAnswerTypeID:
|
||||
// Decoding inputPollAnswer#199fed96.
|
||||
v := InputPollAnswer{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PollAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode PollAnswerClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// PollAnswer boxes the PollAnswerClass providing a helper.
|
||||
type PollAnswerBox struct {
|
||||
PollAnswer PollAnswerClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for PollAnswerBox.
|
||||
func (b *PollAnswerBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode PollAnswerBox to nil")
|
||||
}
|
||||
v, err := DecodePollAnswer(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.PollAnswer = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for PollAnswerBox.
|
||||
func (b *PollAnswerBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.PollAnswer == nil {
|
||||
return fmt.Errorf("unable to encode PollAnswerClass as nil")
|
||||
}
|
||||
return b.PollAnswer.Encode(buf)
|
||||
}
|
||||
|
||||
Generated
+272
@@ -33,3 +33,275 @@ var (
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// PollAnswerClassArray is adapter for slice of PollAnswerClass.
|
||||
type PollAnswerClassArray []PollAnswerClass
|
||||
|
||||
// Sort sorts slice of PollAnswerClass.
|
||||
func (s PollAnswerClassArray) Sort(less func(a, b PollAnswerClass) bool) PollAnswerClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of PollAnswerClass.
|
||||
func (s PollAnswerClassArray) SortStable(less func(a, b PollAnswerClass) bool) PollAnswerClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of PollAnswerClass.
|
||||
func (s PollAnswerClassArray) Retain(keep func(x PollAnswerClass) bool) PollAnswerClassArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s PollAnswerClassArray) First() (v PollAnswerClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s PollAnswerClassArray) Last() (v PollAnswerClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *PollAnswerClassArray) PopFirst() (v PollAnswerClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero PollAnswerClass
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *PollAnswerClassArray) Pop() (v PollAnswerClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// AsPollAnswer returns copy with only PollAnswer constructors.
|
||||
func (s PollAnswerClassArray) AsPollAnswer() (to PollAnswerArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*PollAnswer)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsInputPollAnswer returns copy with only InputPollAnswer constructors.
|
||||
func (s PollAnswerClassArray) AsInputPollAnswer() (to InputPollAnswerArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputPollAnswer)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// PollAnswerArray is adapter for slice of PollAnswer.
|
||||
type PollAnswerArray []PollAnswer
|
||||
|
||||
// Sort sorts slice of PollAnswer.
|
||||
func (s PollAnswerArray) Sort(less func(a, b PollAnswer) bool) PollAnswerArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of PollAnswer.
|
||||
func (s PollAnswerArray) SortStable(less func(a, b PollAnswer) bool) PollAnswerArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of PollAnswer.
|
||||
func (s PollAnswerArray) Retain(keep func(x PollAnswer) bool) PollAnswerArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s PollAnswerArray) First() (v PollAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s PollAnswerArray) Last() (v PollAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *PollAnswerArray) PopFirst() (v PollAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero PollAnswer
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *PollAnswerArray) Pop() (v PollAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// InputPollAnswerArray is adapter for slice of InputPollAnswer.
|
||||
type InputPollAnswerArray []InputPollAnswer
|
||||
|
||||
// Sort sorts slice of InputPollAnswer.
|
||||
func (s InputPollAnswerArray) Sort(less func(a, b InputPollAnswer) bool) InputPollAnswerArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPollAnswer.
|
||||
func (s InputPollAnswerArray) SortStable(less func(a, b InputPollAnswer) bool) InputPollAnswerArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPollAnswer.
|
||||
func (s InputPollAnswerArray) Retain(keep func(x InputPollAnswer) bool) InputPollAnswerArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s InputPollAnswerArray) First() (v InputPollAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPollAnswerArray) Last() (v InputPollAnswer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *InputPollAnswerArray) PopFirst() (v InputPollAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero InputPollAnswer
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *InputPollAnswerArray) Pop() (v InputPollAnswer, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
Generated
+113
-18
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// PollAnswerVoters represents TL type `pollAnswerVoters#3b6ddad2`.
|
||||
// PollAnswerVoters represents TL type `pollAnswerVoters#3645230a`.
|
||||
// A poll answer, and how users voted on it
|
||||
//
|
||||
// See https://core.telegram.org/constructor/pollAnswerVoters for reference.
|
||||
@@ -51,11 +51,17 @@ type PollAnswerVoters struct {
|
||||
// 1) https://core.telegram.org/method/messages.sendVote
|
||||
Option []byte
|
||||
// How many users voted for this option
|
||||
//
|
||||
// Use SetVoters and GetVoters helpers.
|
||||
Voters int
|
||||
// RecentVoters field of PollAnswerVoters.
|
||||
//
|
||||
// Use SetRecentVoters and GetRecentVoters helpers.
|
||||
RecentVoters []PeerClass
|
||||
}
|
||||
|
||||
// PollAnswerVotersTypeID is TL type id of PollAnswerVoters.
|
||||
const PollAnswerVotersTypeID = 0x3b6ddad2
|
||||
const PollAnswerVotersTypeID = 0x3645230a
|
||||
|
||||
// Ensuring interfaces in compile-time for PollAnswerVoters.
|
||||
var (
|
||||
@@ -84,6 +90,9 @@ func (p *PollAnswerVoters) Zero() bool {
|
||||
if !(p.Voters == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.RecentVoters == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -102,12 +111,20 @@ func (p *PollAnswerVoters) FillFrom(from interface {
|
||||
GetChosen() (value bool)
|
||||
GetCorrect() (value bool)
|
||||
GetOption() (value []byte)
|
||||
GetVoters() (value int)
|
||||
GetVoters() (value int, ok bool)
|
||||
GetRecentVoters() (value []PeerClass, ok bool)
|
||||
}) {
|
||||
p.Chosen = from.GetChosen()
|
||||
p.Correct = from.GetCorrect()
|
||||
p.Option = from.GetOption()
|
||||
p.Voters = from.GetVoters()
|
||||
if val, ok := from.GetVoters(); ok {
|
||||
p.Voters = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetRecentVoters(); ok {
|
||||
p.RecentVoters = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -150,6 +167,12 @@ func (p *PollAnswerVoters) TypeInfo() tdp.Type {
|
||||
{
|
||||
Name: "Voters",
|
||||
SchemaName: "voters",
|
||||
Null: !p.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "RecentVoters",
|
||||
SchemaName: "recent_voters",
|
||||
Null: !p.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
@@ -163,12 +186,18 @@ func (p *PollAnswerVoters) SetFlags() {
|
||||
if !(p.Correct == false) {
|
||||
p.Flags.Set(1)
|
||||
}
|
||||
if !(p.Voters == 0) {
|
||||
p.Flags.Set(2)
|
||||
}
|
||||
if !(p.RecentVoters == nil) {
|
||||
p.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PollAnswerVoters) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollAnswerVoters#3b6ddad2 as nil")
|
||||
return fmt.Errorf("can't encode pollAnswerVoters#3645230a as nil")
|
||||
}
|
||||
b.PutID(PollAnswerVotersTypeID)
|
||||
return p.EncodeBare(b)
|
||||
@@ -177,24 +206,37 @@ func (p *PollAnswerVoters) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PollAnswerVoters) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollAnswerVoters#3b6ddad2 as nil")
|
||||
return fmt.Errorf("can't encode pollAnswerVoters#3645230a as nil")
|
||||
}
|
||||
p.SetFlags()
|
||||
if err := p.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswerVoters#3b6ddad2: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode pollAnswerVoters#3645230a: field flags: %w", err)
|
||||
}
|
||||
b.PutBytes(p.Option)
|
||||
b.PutInt(p.Voters)
|
||||
if p.Flags.Has(2) {
|
||||
b.PutInt(p.Voters)
|
||||
}
|
||||
if p.Flags.Has(2) {
|
||||
b.PutVectorHeader(len(p.RecentVoters))
|
||||
for idx, v := range p.RecentVoters {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode pollAnswerVoters#3645230a: field recent_voters element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollAnswerVoters#3645230a: field recent_voters element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PollAnswerVoters) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollAnswerVoters#3b6ddad2 to nil")
|
||||
return fmt.Errorf("can't decode pollAnswerVoters#3645230a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PollAnswerVotersTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3b6ddad2: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
@@ -202,11 +244,11 @@ func (p *PollAnswerVoters) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PollAnswerVoters) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollAnswerVoters#3b6ddad2 to nil")
|
||||
return fmt.Errorf("can't decode pollAnswerVoters#3645230a to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3b6ddad2: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
p.Chosen = p.Flags.Has(0)
|
||||
@@ -214,17 +256,34 @@ func (p *PollAnswerVoters) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3b6ddad2: field option: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: field option: %w", err)
|
||||
}
|
||||
p.Option = value
|
||||
}
|
||||
{
|
||||
if p.Flags.Has(2) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3b6ddad2: field voters: %w", err)
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: field voters: %w", err)
|
||||
}
|
||||
p.Voters = value
|
||||
}
|
||||
if p.Flags.Has(2) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: field recent_voters: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
p.RecentVoters = make([]PeerClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollAnswerVoters#3645230a: field recent_voters: %w", err)
|
||||
}
|
||||
p.RecentVoters = append(p.RecentVoters, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -274,10 +333,46 @@ func (p *PollAnswerVoters) GetOption() (value []byte) {
|
||||
return p.Option
|
||||
}
|
||||
|
||||
// GetVoters returns value of Voters field.
|
||||
func (p *PollAnswerVoters) GetVoters() (value int) {
|
||||
// SetVoters sets value of Voters conditional field.
|
||||
func (p *PollAnswerVoters) SetVoters(value int) {
|
||||
p.Flags.Set(2)
|
||||
p.Voters = value
|
||||
}
|
||||
|
||||
// GetVoters returns value of Voters conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollAnswerVoters) GetVoters() (value int, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Voters
|
||||
if !p.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return p.Voters, true
|
||||
}
|
||||
|
||||
// SetRecentVoters sets value of RecentVoters conditional field.
|
||||
func (p *PollAnswerVoters) SetRecentVoters(value []PeerClass) {
|
||||
p.Flags.Set(2)
|
||||
p.RecentVoters = value
|
||||
}
|
||||
|
||||
// GetRecentVoters returns value of RecentVoters conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollAnswerVoters) GetRecentVoters() (value []PeerClass, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return p.RecentVoters, true
|
||||
}
|
||||
|
||||
// MapRecentVoters returns field RecentVoters wrapped in PeerClassArray helper.
|
||||
func (p *PollAnswerVoters) MapRecentVoters() (value PeerClassArray, ok bool) {
|
||||
if !p.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return PeerClassArray(p.RecentVoters), true
|
||||
}
|
||||
|
||||
Generated
+233
-23
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// Poll represents TL type `poll#58747131`.
|
||||
// Poll represents TL type `poll#b8425be9`.
|
||||
// Poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/poll for reference.
|
||||
@@ -52,6 +52,16 @@ type Poll struct {
|
||||
// Whether this is a quiz (with wrong and correct answers, results shown in the return
|
||||
// type)
|
||||
Quiz bool
|
||||
// OpenAnswers field of Poll.
|
||||
OpenAnswers bool
|
||||
// RevotingDisabled field of Poll.
|
||||
RevotingDisabled bool
|
||||
// ShuffleAnswers field of Poll.
|
||||
ShuffleAnswers bool
|
||||
// HideResultsUntilClose field of Poll.
|
||||
HideResultsUntilClose bool
|
||||
// Creator field of Poll.
|
||||
Creator bool
|
||||
// The question of the poll (only Premium¹ users can use custom emoji entities² here).
|
||||
//
|
||||
// Links:
|
||||
@@ -63,7 +73,7 @@ type Poll struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/config#poll-answers-max
|
||||
// 2) https://core.telegram.org/method/messages.sendVote
|
||||
Answers []PollAnswer
|
||||
Answers []PollAnswerClass
|
||||
// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used
|
||||
// together with close_date.
|
||||
//
|
||||
@@ -75,10 +85,12 @@ type Poll struct {
|
||||
//
|
||||
// Use SetCloseDate and GetCloseDate helpers.
|
||||
CloseDate int
|
||||
// Hash field of Poll.
|
||||
Hash int64
|
||||
}
|
||||
|
||||
// PollTypeID is TL type id of Poll.
|
||||
const PollTypeID = 0x58747131
|
||||
const PollTypeID = 0xb8425be9
|
||||
|
||||
// Ensuring interfaces in compile-time for Poll.
|
||||
var (
|
||||
@@ -110,6 +122,21 @@ func (p *Poll) Zero() bool {
|
||||
if !(p.Quiz == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.OpenAnswers == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.RevotingDisabled == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.ShuffleAnswers == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.HideResultsUntilClose == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.Creator == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.Question.Zero()) {
|
||||
return false
|
||||
}
|
||||
@@ -122,6 +149,9 @@ func (p *Poll) Zero() bool {
|
||||
if !(p.CloseDate == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.Hash == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -142,16 +172,27 @@ func (p *Poll) FillFrom(from interface {
|
||||
GetPublicVoters() (value bool)
|
||||
GetMultipleChoice() (value bool)
|
||||
GetQuiz() (value bool)
|
||||
GetOpenAnswers() (value bool)
|
||||
GetRevotingDisabled() (value bool)
|
||||
GetShuffleAnswers() (value bool)
|
||||
GetHideResultsUntilClose() (value bool)
|
||||
GetCreator() (value bool)
|
||||
GetQuestion() (value TextWithEntities)
|
||||
GetAnswers() (value []PollAnswer)
|
||||
GetAnswers() (value []PollAnswerClass)
|
||||
GetClosePeriod() (value int, ok bool)
|
||||
GetCloseDate() (value int, ok bool)
|
||||
GetHash() (value int64)
|
||||
}) {
|
||||
p.ID = from.GetID()
|
||||
p.Closed = from.GetClosed()
|
||||
p.PublicVoters = from.GetPublicVoters()
|
||||
p.MultipleChoice = from.GetMultipleChoice()
|
||||
p.Quiz = from.GetQuiz()
|
||||
p.OpenAnswers = from.GetOpenAnswers()
|
||||
p.RevotingDisabled = from.GetRevotingDisabled()
|
||||
p.ShuffleAnswers = from.GetShuffleAnswers()
|
||||
p.HideResultsUntilClose = from.GetHideResultsUntilClose()
|
||||
p.Creator = from.GetCreator()
|
||||
p.Question = from.GetQuestion()
|
||||
p.Answers = from.GetAnswers()
|
||||
if val, ok := from.GetClosePeriod(); ok {
|
||||
@@ -162,6 +203,7 @@ func (p *Poll) FillFrom(from interface {
|
||||
p.CloseDate = val
|
||||
}
|
||||
|
||||
p.Hash = from.GetHash()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -211,6 +253,31 @@ func (p *Poll) TypeInfo() tdp.Type {
|
||||
SchemaName: "quiz",
|
||||
Null: !p.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "OpenAnswers",
|
||||
SchemaName: "open_answers",
|
||||
Null: !p.Flags.Has(6),
|
||||
},
|
||||
{
|
||||
Name: "RevotingDisabled",
|
||||
SchemaName: "revoting_disabled",
|
||||
Null: !p.Flags.Has(7),
|
||||
},
|
||||
{
|
||||
Name: "ShuffleAnswers",
|
||||
SchemaName: "shuffle_answers",
|
||||
Null: !p.Flags.Has(8),
|
||||
},
|
||||
{
|
||||
Name: "HideResultsUntilClose",
|
||||
SchemaName: "hide_results_until_close",
|
||||
Null: !p.Flags.Has(9),
|
||||
},
|
||||
{
|
||||
Name: "Creator",
|
||||
SchemaName: "creator",
|
||||
Null: !p.Flags.Has(10),
|
||||
},
|
||||
{
|
||||
Name: "Question",
|
||||
SchemaName: "question",
|
||||
@@ -229,6 +296,10 @@ func (p *Poll) TypeInfo() tdp.Type {
|
||||
SchemaName: "close_date",
|
||||
Null: !p.Flags.Has(5),
|
||||
},
|
||||
{
|
||||
Name: "Hash",
|
||||
SchemaName: "hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -247,6 +318,21 @@ func (p *Poll) SetFlags() {
|
||||
if !(p.Quiz == false) {
|
||||
p.Flags.Set(3)
|
||||
}
|
||||
if !(p.OpenAnswers == false) {
|
||||
p.Flags.Set(6)
|
||||
}
|
||||
if !(p.RevotingDisabled == false) {
|
||||
p.Flags.Set(7)
|
||||
}
|
||||
if !(p.ShuffleAnswers == false) {
|
||||
p.Flags.Set(8)
|
||||
}
|
||||
if !(p.HideResultsUntilClose == false) {
|
||||
p.Flags.Set(9)
|
||||
}
|
||||
if !(p.Creator == false) {
|
||||
p.Flags.Set(10)
|
||||
}
|
||||
if !(p.ClosePeriod == 0) {
|
||||
p.Flags.Set(4)
|
||||
}
|
||||
@@ -258,7 +344,7 @@ func (p *Poll) SetFlags() {
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *Poll) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode poll#58747131 as nil")
|
||||
return fmt.Errorf("can't encode poll#b8425be9 as nil")
|
||||
}
|
||||
b.PutID(PollTypeID)
|
||||
return p.EncodeBare(b)
|
||||
@@ -267,20 +353,23 @@ func (p *Poll) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *Poll) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode poll#58747131 as nil")
|
||||
return fmt.Errorf("can't encode poll#b8425be9 as nil")
|
||||
}
|
||||
p.SetFlags()
|
||||
b.PutLong(p.ID)
|
||||
if err := p.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode poll#58747131: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode poll#b8425be9: field flags: %w", err)
|
||||
}
|
||||
if err := p.Question.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode poll#58747131: field question: %w", err)
|
||||
return fmt.Errorf("unable to encode poll#b8425be9: field question: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(p.Answers))
|
||||
for idx, v := range p.Answers {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode poll#b8425be9: field answers element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode poll#58747131: field answers element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode poll#b8425be9: field answers element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
if p.Flags.Has(4) {
|
||||
@@ -289,16 +378,17 @@ func (p *Poll) EncodeBare(b *bin.Buffer) error {
|
||||
if p.Flags.Has(5) {
|
||||
b.PutInt(p.CloseDate)
|
||||
}
|
||||
b.PutLong(p.Hash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *Poll) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode poll#58747131 to nil")
|
||||
return fmt.Errorf("can't decode poll#b8425be9 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PollTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
@@ -306,42 +396,47 @@ func (p *Poll) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *Poll) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode poll#58747131 to nil")
|
||||
return fmt.Errorf("can't decode poll#b8425be9 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field id: %w", err)
|
||||
}
|
||||
p.ID = value
|
||||
}
|
||||
{
|
||||
if err := p.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
p.Closed = p.Flags.Has(0)
|
||||
p.PublicVoters = p.Flags.Has(1)
|
||||
p.MultipleChoice = p.Flags.Has(2)
|
||||
p.Quiz = p.Flags.Has(3)
|
||||
p.OpenAnswers = p.Flags.Has(6)
|
||||
p.RevotingDisabled = p.Flags.Has(7)
|
||||
p.ShuffleAnswers = p.Flags.Has(8)
|
||||
p.HideResultsUntilClose = p.Flags.Has(9)
|
||||
p.Creator = p.Flags.Has(10)
|
||||
{
|
||||
if err := p.Question.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field question: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field question: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field answers: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field answers: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
p.Answers = make([]PollAnswer, 0, headerLen%bin.PreallocateLimit)
|
||||
p.Answers = make([]PollAnswerClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value PollAnswer
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field answers: %w", err)
|
||||
value, err := DecodePollAnswer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field answers: %w", err)
|
||||
}
|
||||
p.Answers = append(p.Answers, value)
|
||||
}
|
||||
@@ -349,17 +444,24 @@ func (p *Poll) DecodeBare(b *bin.Buffer) error {
|
||||
if p.Flags.Has(4) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field close_period: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field close_period: %w", err)
|
||||
}
|
||||
p.ClosePeriod = value
|
||||
}
|
||||
if p.Flags.Has(5) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#58747131: field close_date: %w", err)
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field close_date: %w", err)
|
||||
}
|
||||
p.CloseDate = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode poll#b8425be9: field hash: %w", err)
|
||||
}
|
||||
p.Hash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -447,6 +549,101 @@ func (p *Poll) GetQuiz() (value bool) {
|
||||
return p.Flags.Has(3)
|
||||
}
|
||||
|
||||
// SetOpenAnswers sets value of OpenAnswers conditional field.
|
||||
func (p *Poll) SetOpenAnswers(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(6)
|
||||
p.OpenAnswers = true
|
||||
} else {
|
||||
p.Flags.Unset(6)
|
||||
p.OpenAnswers = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetOpenAnswers returns value of OpenAnswers conditional field.
|
||||
func (p *Poll) GetOpenAnswers() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(6)
|
||||
}
|
||||
|
||||
// SetRevotingDisabled sets value of RevotingDisabled conditional field.
|
||||
func (p *Poll) SetRevotingDisabled(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(7)
|
||||
p.RevotingDisabled = true
|
||||
} else {
|
||||
p.Flags.Unset(7)
|
||||
p.RevotingDisabled = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetRevotingDisabled returns value of RevotingDisabled conditional field.
|
||||
func (p *Poll) GetRevotingDisabled() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(7)
|
||||
}
|
||||
|
||||
// SetShuffleAnswers sets value of ShuffleAnswers conditional field.
|
||||
func (p *Poll) SetShuffleAnswers(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(8)
|
||||
p.ShuffleAnswers = true
|
||||
} else {
|
||||
p.Flags.Unset(8)
|
||||
p.ShuffleAnswers = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetShuffleAnswers returns value of ShuffleAnswers conditional field.
|
||||
func (p *Poll) GetShuffleAnswers() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(8)
|
||||
}
|
||||
|
||||
// SetHideResultsUntilClose sets value of HideResultsUntilClose conditional field.
|
||||
func (p *Poll) SetHideResultsUntilClose(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(9)
|
||||
p.HideResultsUntilClose = true
|
||||
} else {
|
||||
p.Flags.Unset(9)
|
||||
p.HideResultsUntilClose = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetHideResultsUntilClose returns value of HideResultsUntilClose conditional field.
|
||||
func (p *Poll) GetHideResultsUntilClose() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(9)
|
||||
}
|
||||
|
||||
// SetCreator sets value of Creator conditional field.
|
||||
func (p *Poll) SetCreator(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(10)
|
||||
p.Creator = true
|
||||
} else {
|
||||
p.Flags.Unset(10)
|
||||
p.Creator = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetCreator returns value of Creator conditional field.
|
||||
func (p *Poll) GetCreator() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(10)
|
||||
}
|
||||
|
||||
// GetQuestion returns value of Question field.
|
||||
func (p *Poll) GetQuestion() (value TextWithEntities) {
|
||||
if p == nil {
|
||||
@@ -456,7 +653,7 @@ func (p *Poll) GetQuestion() (value TextWithEntities) {
|
||||
}
|
||||
|
||||
// GetAnswers returns value of Answers field.
|
||||
func (p *Poll) GetAnswers() (value []PollAnswer) {
|
||||
func (p *Poll) GetAnswers() (value []PollAnswerClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
@@ -498,3 +695,16 @@ func (p *Poll) GetCloseDate() (value int, ok bool) {
|
||||
}
|
||||
return p.CloseDate, true
|
||||
}
|
||||
|
||||
// GetHash returns value of Hash field.
|
||||
func (p *Poll) GetHash() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Hash
|
||||
}
|
||||
|
||||
// MapAnswers returns field Answers wrapped in PollAnswerClassArray helper.
|
||||
func (p *Poll) MapAnswers() (value PollAnswerClassArray) {
|
||||
return PollAnswerClassArray(p.Answers)
|
||||
}
|
||||
|
||||
Generated
+110
-22
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// PollResults represents TL type `pollResults#7adf2420`.
|
||||
// PollResults represents TL type `pollResults#ba7bb15e`.
|
||||
// Results of poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/pollResults for reference.
|
||||
@@ -49,6 +49,8 @@ type PollResults struct {
|
||||
// 1) https://core.telegram.org/api/min
|
||||
// 2) https://core.telegram.org/method/messages.getPollResults
|
||||
Min bool
|
||||
// HasUnreadVotes field of PollResults.
|
||||
HasUnreadVotes bool
|
||||
// Poll results
|
||||
//
|
||||
// Use SetResults and GetResults helpers.
|
||||
@@ -72,10 +74,14 @@ type PollResults struct {
|
||||
//
|
||||
// Use SetSolutionEntities and GetSolutionEntities helpers.
|
||||
SolutionEntities []MessageEntityClass
|
||||
// SolutionMedia field of PollResults.
|
||||
//
|
||||
// Use SetSolutionMedia and GetSolutionMedia helpers.
|
||||
SolutionMedia MessageMediaClass
|
||||
}
|
||||
|
||||
// PollResultsTypeID is TL type id of PollResults.
|
||||
const PollResultsTypeID = 0x7adf2420
|
||||
const PollResultsTypeID = 0xba7bb15e
|
||||
|
||||
// Ensuring interfaces in compile-time for PollResults.
|
||||
var (
|
||||
@@ -95,6 +101,9 @@ func (p *PollResults) Zero() bool {
|
||||
if !(p.Min == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.HasUnreadVotes == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.Results == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -110,6 +119,9 @@ func (p *PollResults) Zero() bool {
|
||||
if !(p.SolutionEntities == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.SolutionMedia == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -126,13 +138,16 @@ func (p *PollResults) String() string {
|
||||
// FillFrom fills PollResults from given interface.
|
||||
func (p *PollResults) FillFrom(from interface {
|
||||
GetMin() (value bool)
|
||||
GetHasUnreadVotes() (value bool)
|
||||
GetResults() (value []PollAnswerVoters, ok bool)
|
||||
GetTotalVoters() (value int, ok bool)
|
||||
GetRecentVoters() (value []PeerClass, ok bool)
|
||||
GetSolution() (value string, ok bool)
|
||||
GetSolutionEntities() (value []MessageEntityClass, ok bool)
|
||||
GetSolutionMedia() (value MessageMediaClass, ok bool)
|
||||
}) {
|
||||
p.Min = from.GetMin()
|
||||
p.HasUnreadVotes = from.GetHasUnreadVotes()
|
||||
if val, ok := from.GetResults(); ok {
|
||||
p.Results = val
|
||||
}
|
||||
@@ -153,6 +168,10 @@ func (p *PollResults) FillFrom(from interface {
|
||||
p.SolutionEntities = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSolutionMedia(); ok {
|
||||
p.SolutionMedia = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -183,6 +202,11 @@ func (p *PollResults) TypeInfo() tdp.Type {
|
||||
SchemaName: "min",
|
||||
Null: !p.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "HasUnreadVotes",
|
||||
SchemaName: "has_unread_votes",
|
||||
Null: !p.Flags.Has(6),
|
||||
},
|
||||
{
|
||||
Name: "Results",
|
||||
SchemaName: "results",
|
||||
@@ -208,6 +232,11 @@ func (p *PollResults) TypeInfo() tdp.Type {
|
||||
SchemaName: "solution_entities",
|
||||
Null: !p.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "SolutionMedia",
|
||||
SchemaName: "solution_media",
|
||||
Null: !p.Flags.Has(5),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -217,6 +246,9 @@ func (p *PollResults) SetFlags() {
|
||||
if !(p.Min == false) {
|
||||
p.Flags.Set(0)
|
||||
}
|
||||
if !(p.HasUnreadVotes == false) {
|
||||
p.Flags.Set(6)
|
||||
}
|
||||
if !(p.Results == nil) {
|
||||
p.Flags.Set(1)
|
||||
}
|
||||
@@ -232,12 +264,15 @@ func (p *PollResults) SetFlags() {
|
||||
if !(p.SolutionEntities == nil) {
|
||||
p.Flags.Set(4)
|
||||
}
|
||||
if !(p.SolutionMedia == nil) {
|
||||
p.Flags.Set(5)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PollResults) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollResults#7adf2420 as nil")
|
||||
return fmt.Errorf("can't encode pollResults#ba7bb15e as nil")
|
||||
}
|
||||
b.PutID(PollResultsTypeID)
|
||||
return p.EncodeBare(b)
|
||||
@@ -246,17 +281,17 @@ func (p *PollResults) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PollResults) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pollResults#7adf2420 as nil")
|
||||
return fmt.Errorf("can't encode pollResults#ba7bb15e as nil")
|
||||
}
|
||||
p.SetFlags()
|
||||
if err := p.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field flags: %w", err)
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
b.PutVectorHeader(len(p.Results))
|
||||
for idx, v := range p.Results {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field results element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field results element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,10 +302,10 @@ func (p *PollResults) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(p.RecentVoters))
|
||||
for idx, v := range p.RecentVoters {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field recent_voters element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field recent_voters element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field recent_voters element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field recent_voters element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,23 +316,31 @@ func (p *PollResults) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(p.SolutionEntities))
|
||||
for idx, v := range p.SolutionEntities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field solution_entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field solution_entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollResults#7adf2420: field solution_entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field solution_entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if p.Flags.Has(5) {
|
||||
if p.SolutionMedia == nil {
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field solution_media is nil")
|
||||
}
|
||||
if err := p.SolutionMedia.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode pollResults#ba7bb15e: field solution_media: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PollResults) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollResults#7adf2420 to nil")
|
||||
return fmt.Errorf("can't decode pollResults#ba7bb15e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PollResultsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
@@ -305,18 +348,19 @@ func (p *PollResults) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pollResults#7adf2420 to nil")
|
||||
return fmt.Errorf("can't decode pollResults#ba7bb15e to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
p.Min = p.Flags.Has(0)
|
||||
p.HasUnreadVotes = p.Flags.Has(6)
|
||||
if p.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field results: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field results: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -325,7 +369,7 @@ func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value PollAnswerVoters
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field results: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field results: %w", err)
|
||||
}
|
||||
p.Results = append(p.Results, value)
|
||||
}
|
||||
@@ -333,14 +377,14 @@ func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
if p.Flags.Has(2) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field total_voters: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field total_voters: %w", err)
|
||||
}
|
||||
p.TotalVoters = value
|
||||
}
|
||||
if p.Flags.Has(3) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field recent_voters: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field recent_voters: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -349,7 +393,7 @@ func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field recent_voters: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field recent_voters: %w", err)
|
||||
}
|
||||
p.RecentVoters = append(p.RecentVoters, value)
|
||||
}
|
||||
@@ -357,14 +401,14 @@ func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
if p.Flags.Has(4) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field solution: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field solution: %w", err)
|
||||
}
|
||||
p.Solution = value
|
||||
}
|
||||
if p.Flags.Has(4) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field solution_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field solution_entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -373,11 +417,18 @@ func (p *PollResults) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#7adf2420: field solution_entities: %w", err)
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field solution_entities: %w", err)
|
||||
}
|
||||
p.SolutionEntities = append(p.SolutionEntities, value)
|
||||
}
|
||||
}
|
||||
if p.Flags.Has(5) {
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pollResults#ba7bb15e: field solution_media: %w", err)
|
||||
}
|
||||
p.SolutionMedia = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -400,6 +451,25 @@ func (p *PollResults) GetMin() (value bool) {
|
||||
return p.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetHasUnreadVotes sets value of HasUnreadVotes conditional field.
|
||||
func (p *PollResults) SetHasUnreadVotes(value bool) {
|
||||
if value {
|
||||
p.Flags.Set(6)
|
||||
p.HasUnreadVotes = true
|
||||
} else {
|
||||
p.Flags.Unset(6)
|
||||
p.HasUnreadVotes = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetHasUnreadVotes returns value of HasUnreadVotes conditional field.
|
||||
func (p *PollResults) GetHasUnreadVotes() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Flags.Has(6)
|
||||
}
|
||||
|
||||
// SetResults sets value of Results conditional field.
|
||||
func (p *PollResults) SetResults(value []PollAnswerVoters) {
|
||||
p.Flags.Set(1)
|
||||
@@ -490,6 +560,24 @@ func (p *PollResults) GetSolutionEntities() (value []MessageEntityClass, ok bool
|
||||
return p.SolutionEntities, true
|
||||
}
|
||||
|
||||
// SetSolutionMedia sets value of SolutionMedia conditional field.
|
||||
func (p *PollResults) SetSolutionMedia(value MessageMediaClass) {
|
||||
p.Flags.Set(5)
|
||||
p.SolutionMedia = value
|
||||
}
|
||||
|
||||
// GetSolutionMedia returns value of SolutionMedia conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *PollResults) GetSolutionMedia() (value MessageMediaClass, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(5) {
|
||||
return value, false
|
||||
}
|
||||
return p.SolutionMedia, true
|
||||
}
|
||||
|
||||
// MapRecentVoters returns field RecentVoters wrapped in PeerClassArray helper.
|
||||
func (p *PollResults) MapRecentVoters() (value PeerClassArray, ok bool) {
|
||||
if !p.Flags.Has(3) {
|
||||
|
||||
+72
-19
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// ReactionsNotifySettings represents TL type `reactionsNotifySettings#56e34970`.
|
||||
// ReactionsNotifySettings represents TL type `reactionsNotifySettings#71e4ea58`.
|
||||
// Reaction notification settings, see here »¹ for more info.
|
||||
//
|
||||
// Links:
|
||||
@@ -54,6 +54,10 @@ type ReactionsNotifySettings struct {
|
||||
//
|
||||
// Use SetStoriesNotifyFrom and GetStoriesNotifyFrom helpers.
|
||||
StoriesNotifyFrom ReactionNotificationsFromClass
|
||||
// PollVotesNotifyFrom field of ReactionsNotifySettings.
|
||||
//
|
||||
// Use SetPollVotesNotifyFrom and GetPollVotesNotifyFrom helpers.
|
||||
PollVotesNotifyFrom ReactionNotificationsFromClass
|
||||
// Notification sound for reactions »¹
|
||||
//
|
||||
// Links:
|
||||
@@ -69,7 +73,7 @@ type ReactionsNotifySettings struct {
|
||||
}
|
||||
|
||||
// ReactionsNotifySettingsTypeID is TL type id of ReactionsNotifySettings.
|
||||
const ReactionsNotifySettingsTypeID = 0x56e34970
|
||||
const ReactionsNotifySettingsTypeID = 0x71e4ea58
|
||||
|
||||
// Ensuring interfaces in compile-time for ReactionsNotifySettings.
|
||||
var (
|
||||
@@ -92,6 +96,9 @@ func (r *ReactionsNotifySettings) Zero() bool {
|
||||
if !(r.StoriesNotifyFrom == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.PollVotesNotifyFrom == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.Sound == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -115,6 +122,7 @@ func (r *ReactionsNotifySettings) String() string {
|
||||
func (r *ReactionsNotifySettings) FillFrom(from interface {
|
||||
GetMessagesNotifyFrom() (value ReactionNotificationsFromClass, ok bool)
|
||||
GetStoriesNotifyFrom() (value ReactionNotificationsFromClass, ok bool)
|
||||
GetPollVotesNotifyFrom() (value ReactionNotificationsFromClass, ok bool)
|
||||
GetSound() (value NotificationSoundClass)
|
||||
GetShowPreviews() (value bool)
|
||||
}) {
|
||||
@@ -126,6 +134,10 @@ func (r *ReactionsNotifySettings) FillFrom(from interface {
|
||||
r.StoriesNotifyFrom = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetPollVotesNotifyFrom(); ok {
|
||||
r.PollVotesNotifyFrom = val
|
||||
}
|
||||
|
||||
r.Sound = from.GetSound()
|
||||
r.ShowPreviews = from.GetShowPreviews()
|
||||
}
|
||||
@@ -163,6 +175,11 @@ func (r *ReactionsNotifySettings) TypeInfo() tdp.Type {
|
||||
SchemaName: "stories_notify_from",
|
||||
Null: !r.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "PollVotesNotifyFrom",
|
||||
SchemaName: "poll_votes_notify_from",
|
||||
Null: !r.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "Sound",
|
||||
SchemaName: "sound",
|
||||
@@ -183,12 +200,15 @@ func (r *ReactionsNotifySettings) SetFlags() {
|
||||
if !(r.StoriesNotifyFrom == nil) {
|
||||
r.Flags.Set(1)
|
||||
}
|
||||
if !(r.PollVotesNotifyFrom == nil) {
|
||||
r.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ReactionsNotifySettings) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode reactionsNotifySettings#56e34970 as nil")
|
||||
return fmt.Errorf("can't encode reactionsNotifySettings#71e4ea58 as nil")
|
||||
}
|
||||
b.PutID(ReactionsNotifySettingsTypeID)
|
||||
return r.EncodeBare(b)
|
||||
@@ -197,33 +217,41 @@ func (r *ReactionsNotifySettings) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ReactionsNotifySettings) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode reactionsNotifySettings#56e34970 as nil")
|
||||
return fmt.Errorf("can't encode reactionsNotifySettings#71e4ea58 as nil")
|
||||
}
|
||||
r.SetFlags()
|
||||
if err := r.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field flags: %w", err)
|
||||
}
|
||||
if r.Flags.Has(0) {
|
||||
if r.MessagesNotifyFrom == nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field messages_notify_from is nil")
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field messages_notify_from is nil")
|
||||
}
|
||||
if err := r.MessagesNotifyFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field messages_notify_from: %w", err)
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field messages_notify_from: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
if r.StoriesNotifyFrom == nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field stories_notify_from is nil")
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field stories_notify_from is nil")
|
||||
}
|
||||
if err := r.StoriesNotifyFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field stories_notify_from: %w", err)
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field stories_notify_from: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Flags.Has(2) {
|
||||
if r.PollVotesNotifyFrom == nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field poll_votes_notify_from is nil")
|
||||
}
|
||||
if err := r.PollVotesNotifyFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field poll_votes_notify_from: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Sound == nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field sound is nil")
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field sound is nil")
|
||||
}
|
||||
if err := r.Sound.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#56e34970: field sound: %w", err)
|
||||
return fmt.Errorf("unable to encode reactionsNotifySettings#71e4ea58: field sound: %w", err)
|
||||
}
|
||||
b.PutBool(r.ShowPreviews)
|
||||
return nil
|
||||
@@ -232,10 +260,10 @@ func (r *ReactionsNotifySettings) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ReactionsNotifySettings) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode reactionsNotifySettings#56e34970 to nil")
|
||||
return fmt.Errorf("can't decode reactionsNotifySettings#71e4ea58 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ReactionsNotifySettingsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
@@ -243,38 +271,45 @@ func (r *ReactionsNotifySettings) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ReactionsNotifySettings) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode reactionsNotifySettings#56e34970 to nil")
|
||||
return fmt.Errorf("can't decode reactionsNotifySettings#71e4ea58 to nil")
|
||||
}
|
||||
{
|
||||
if err := r.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Flags.Has(0) {
|
||||
value, err := DecodeReactionNotificationsFrom(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: field messages_notify_from: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field messages_notify_from: %w", err)
|
||||
}
|
||||
r.MessagesNotifyFrom = value
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
value, err := DecodeReactionNotificationsFrom(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: field stories_notify_from: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field stories_notify_from: %w", err)
|
||||
}
|
||||
r.StoriesNotifyFrom = value
|
||||
}
|
||||
if r.Flags.Has(2) {
|
||||
value, err := DecodeReactionNotificationsFrom(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field poll_votes_notify_from: %w", err)
|
||||
}
|
||||
r.PollVotesNotifyFrom = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeNotificationSound(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: field sound: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field sound: %w", err)
|
||||
}
|
||||
r.Sound = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#56e34970: field show_previews: %w", err)
|
||||
return fmt.Errorf("unable to decode reactionsNotifySettings#71e4ea58: field show_previews: %w", err)
|
||||
}
|
||||
r.ShowPreviews = value
|
||||
}
|
||||
@@ -317,6 +352,24 @@ func (r *ReactionsNotifySettings) GetStoriesNotifyFrom() (value ReactionNotifica
|
||||
return r.StoriesNotifyFrom, true
|
||||
}
|
||||
|
||||
// SetPollVotesNotifyFrom sets value of PollVotesNotifyFrom conditional field.
|
||||
func (r *ReactionsNotifySettings) SetPollVotesNotifyFrom(value ReactionNotificationsFromClass) {
|
||||
r.Flags.Set(2)
|
||||
r.PollVotesNotifyFrom = value
|
||||
}
|
||||
|
||||
// GetPollVotesNotifyFrom returns value of PollVotesNotifyFrom conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (r *ReactionsNotifySettings) GetPollVotesNotifyFrom() (value ReactionNotificationsFromClass, ok bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if !r.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return r.PollVotesNotifyFrom, true
|
||||
}
|
||||
|
||||
// GetSound returns value of Sound field.
|
||||
func (r *ReactionsNotifySettings) GetSound() (value NotificationSoundClass) {
|
||||
if r == nil {
|
||||
|
||||
Generated
+117
-26
@@ -32,7 +32,7 @@ var (
|
||||
)
|
||||
|
||||
// Layer version of schema.
|
||||
const Layer = 223
|
||||
const Layer = 224
|
||||
|
||||
// TypesMap returns mapping from type ids to TL type names.
|
||||
func TypesMap() map[uint32]string {
|
||||
@@ -58,8 +58,8 @@ func TypesMap() map[uint32]string {
|
||||
InputFileBigTypeID: "inputFileBig#fa4f0bb5",
|
||||
InputFileStoryDocumentTypeID: "inputFileStoryDocument#62dc8b48",
|
||||
InputMediaEmptyTypeID: "inputMediaEmpty#9664f57f",
|
||||
InputMediaUploadedPhotoTypeID: "inputMediaUploadedPhoto#1e287d04",
|
||||
InputMediaPhotoTypeID: "inputMediaPhoto#b3ba0635",
|
||||
InputMediaUploadedPhotoTypeID: "inputMediaUploadedPhoto#7d8375da",
|
||||
InputMediaPhotoTypeID: "inputMediaPhoto#e3af4434",
|
||||
InputMediaGeoPointTypeID: "inputMediaGeoPoint#f9c44144",
|
||||
InputMediaContactTypeID: "inputMediaContact#f8ab7dfb",
|
||||
InputMediaUploadedDocumentTypeID: "inputMediaUploadedDocument#37c9330",
|
||||
@@ -70,7 +70,7 @@ func TypesMap() map[uint32]string {
|
||||
InputMediaGameTypeID: "inputMediaGame#d33f43f3",
|
||||
InputMediaInvoiceTypeID: "inputMediaInvoice#405fef0d",
|
||||
InputMediaGeoLiveTypeID: "inputMediaGeoLive#971fa843",
|
||||
InputMediaPollTypeID: "inputMediaPoll#f94e5f1",
|
||||
InputMediaPollTypeID: "inputMediaPoll#883a4108",
|
||||
InputMediaDiceTypeID: "inputMediaDice#e66fbf7b",
|
||||
InputMediaStoryTypeID: "inputMediaStory#89fdd778",
|
||||
InputMediaWebPageTypeID: "inputMediaWebPage#c21b8849",
|
||||
@@ -135,7 +135,7 @@ func TypesMap() map[uint32]string {
|
||||
MessageTypeID: "message#3ae56482",
|
||||
MessageServiceTypeID: "messageService#7a800e0a",
|
||||
MessageMediaEmptyTypeID: "messageMediaEmpty#3ded6320",
|
||||
MessageMediaPhotoTypeID: "messageMediaPhoto#695150d7",
|
||||
MessageMediaPhotoTypeID: "messageMediaPhoto#e216eb63",
|
||||
MessageMediaGeoTypeID: "messageMediaGeo#56e0d474",
|
||||
MessageMediaContactTypeID: "messageMediaContact#70322949",
|
||||
MessageMediaUnsupportedTypeID: "messageMediaUnsupported#9f84f49e",
|
||||
@@ -145,7 +145,7 @@ func TypesMap() map[uint32]string {
|
||||
MessageMediaGameTypeID: "messageMediaGame#fdb19008",
|
||||
MessageMediaInvoiceTypeID: "messageMediaInvoice#f6a548d3",
|
||||
MessageMediaGeoLiveTypeID: "messageMediaGeoLive#b940c666",
|
||||
MessageMediaPollTypeID: "messageMediaPoll#4bd6e798",
|
||||
MessageMediaPollTypeID: "messageMediaPoll#773f4e66",
|
||||
MessageMediaDiceTypeID: "messageMediaDice#8cbec07",
|
||||
MessageMediaStoryTypeID: "messageMediaStory#68cb6283",
|
||||
MessageMediaGiveawayTypeID: "messageMediaGiveaway#aa073beb",
|
||||
@@ -217,7 +217,10 @@ func TypesMap() map[uint32]string {
|
||||
MessageActionChangeCreatorTypeID: "messageActionChangeCreator#e188503b",
|
||||
MessageActionNoForwardsToggleTypeID: "messageActionNoForwardsToggle#bf7d6572",
|
||||
MessageActionNoForwardsRequestTypeID: "messageActionNoForwardsRequest#3e2793ba",
|
||||
DialogTypeID: "dialog#d58a08c6",
|
||||
MessageActionPollAppendAnswerTypeID: "messageActionPollAppendAnswer#9da1cd6c",
|
||||
MessageActionPollDeleteAnswerTypeID: "messageActionPollDeleteAnswer#399674dc",
|
||||
MessageActionManagedBotCreatedTypeID: "messageActionManagedBotCreated#16605e3e",
|
||||
DialogTypeID: "dialog#fc89f7f3",
|
||||
DialogFolderTypeID: "dialogFolder#71bd134c",
|
||||
PhotoEmptyTypeID: "photoEmpty#2331b22d",
|
||||
PhotoTypeID: "photo#fb197a65",
|
||||
@@ -255,7 +258,7 @@ func TypesMap() map[uint32]string {
|
||||
InputReportReasonFakeTypeID: "inputReportReasonFake#f5ddd6e7",
|
||||
InputReportReasonIllegalDrugsTypeID: "inputReportReasonIllegalDrugs#a8eb2be",
|
||||
InputReportReasonPersonalDetailsTypeID: "inputReportReasonPersonalDetails#9ec7863d",
|
||||
UserFullTypeID: "userFull#a02bc13e",
|
||||
UserFullTypeID: "userFull#6cbe645",
|
||||
ContactTypeID: "contact#145ade0b",
|
||||
ImportedContactTypeID: "importedContact#c13e3c50",
|
||||
ContactStatusTypeID: "contactStatus#16d9703b",
|
||||
@@ -292,6 +295,7 @@ func TypesMap() map[uint32]string {
|
||||
InputMessagesFilterGeoTypeID: "inputMessagesFilterGeo#e7026d0d",
|
||||
InputMessagesFilterContactsTypeID: "inputMessagesFilterContacts#e062db83",
|
||||
InputMessagesFilterPinnedTypeID: "inputMessagesFilterPinned#1bb00451",
|
||||
InputMessagesFilterPollTypeID: "inputMessagesFilterPoll#fa2bc90a",
|
||||
UpdateNewMessageTypeID: "updateNewMessage#1f2b0afd",
|
||||
UpdateMessageIDTypeID: "updateMessageID#4e90bfd6",
|
||||
UpdateDeleteMessagesTypeID: "updateDeleteMessages#a20db0e5",
|
||||
@@ -354,7 +358,7 @@ func TypesMap() map[uint32]string {
|
||||
UpdateContactsResetTypeID: "updateContactsReset#7084a7be",
|
||||
UpdateChannelAvailableMessagesTypeID: "updateChannelAvailableMessages#b23fc698",
|
||||
UpdateDialogUnreadMarkTypeID: "updateDialogUnreadMark#b658f23e",
|
||||
UpdateMessagePollTypeID: "updateMessagePoll#aca1657b",
|
||||
UpdateMessagePollTypeID: "updateMessagePoll#d64c522b",
|
||||
UpdateChatDefaultBannedRightsTypeID: "updateChatDefaultBannedRights#54c01850",
|
||||
UpdateFolderPeersTypeID: "updateFolderPeers#19360dc0",
|
||||
UpdatePeerSettingsTypeID: "updatePeerSettings#6a7e7366",
|
||||
@@ -364,7 +368,7 @@ func TypesMap() map[uint32]string {
|
||||
UpdateThemeTypeID: "updateTheme#8216fba3",
|
||||
UpdateGeoLiveViewedTypeID: "updateGeoLiveViewed#871fb939",
|
||||
UpdateLoginTokenTypeID: "updateLoginToken#564fe691",
|
||||
UpdateMessagePollVoteTypeID: "updateMessagePollVote#24f40e77",
|
||||
UpdateMessagePollVoteTypeID: "updateMessagePollVote#7699f014",
|
||||
UpdateDialogFilterTypeID: "updateDialogFilter#26ffde7d",
|
||||
UpdateDialogFilterOrderTypeID: "updateDialogFilterOrder#a5d72105",
|
||||
UpdateDialogFiltersTypeID: "updateDialogFilters#3504914f",
|
||||
@@ -445,6 +449,7 @@ func TypesMap() map[uint32]string {
|
||||
UpdateEmojiGameInfoTypeID: "updateEmojiGameInfo#fb9c547a",
|
||||
UpdateStarGiftCraftFailTypeID: "updateStarGiftCraftFail#ac072444",
|
||||
UpdateChatParticipantRankTypeID: "updateChatParticipantRank#bd8367b9",
|
||||
UpdateManagedBotTypeID: "updateManagedBot#4880ed9a",
|
||||
UpdatesStateTypeID: "updates.state#a56c2a3e",
|
||||
UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138",
|
||||
UpdatesDifferenceTypeID: "updates.difference#f49ca0",
|
||||
@@ -662,6 +667,9 @@ func TypesMap() map[uint32]string {
|
||||
MessageEntityCustomEmojiTypeID: "messageEntityCustomEmoji#c8cf05f8",
|
||||
MessageEntityBlockquoteTypeID: "messageEntityBlockquote#f1ccaaac",
|
||||
MessageEntityFormattedDateTypeID: "messageEntityFormattedDate#904ac7c7",
|
||||
MessageEntityDiffInsertTypeID: "messageEntityDiffInsert#71777116",
|
||||
MessageEntityDiffReplaceTypeID: "messageEntityDiffReplace#c6c1e5a7",
|
||||
MessageEntityDiffDeleteTypeID: "messageEntityDiffDelete#652c1c5",
|
||||
InputChannelEmptyTypeID: "inputChannelEmpty#ee8c1e86",
|
||||
InputChannelTypeID: "inputChannel#f35aec28",
|
||||
InputChannelFromMessageTypeID: "inputChannelFromMessage#5b934f9d",
|
||||
@@ -1025,10 +1033,11 @@ func TypesMap() map[uint32]string {
|
||||
HelpSupportNameTypeID: "help.supportName#8c05f1c9",
|
||||
HelpUserInfoEmptyTypeID: "help.userInfoEmpty#f3ae2eed",
|
||||
HelpUserInfoTypeID: "help.userInfo#1eb3758",
|
||||
PollAnswerTypeID: "pollAnswer#ff16e2ca",
|
||||
PollTypeID: "poll#58747131",
|
||||
PollAnswerVotersTypeID: "pollAnswerVoters#3b6ddad2",
|
||||
PollResultsTypeID: "pollResults#7adf2420",
|
||||
PollAnswerTypeID: "pollAnswer#4b7d786a",
|
||||
InputPollAnswerTypeID: "inputPollAnswer#199fed96",
|
||||
PollTypeID: "poll#b8425be9",
|
||||
PollAnswerVotersTypeID: "pollAnswerVoters#3645230a",
|
||||
PollResultsTypeID: "pollResults#ba7bb15e",
|
||||
ChatOnlinesTypeID: "chatOnlines#f041e250",
|
||||
StatsURLTypeID: "statsURL#47a971e0",
|
||||
ChatAdminRightsTypeID: "chatAdminRights#5fb224d5",
|
||||
@@ -1051,7 +1060,7 @@ func TypesMap() map[uint32]string {
|
||||
InputFolderPeerTypeID: "inputFolderPeer#fbd2c296",
|
||||
FolderPeerTypeID: "folderPeer#e9baa668",
|
||||
MessagesSearchCounterTypeID: "messages.searchCounter#e844ebff",
|
||||
URLAuthResultRequestTypeID: "urlAuthResultRequest#f8f8eb1e",
|
||||
URLAuthResultRequestTypeID: "urlAuthResultRequest#3cd623ec",
|
||||
URLAuthResultAcceptedTypeID: "urlAuthResultAccepted#623a8fa0",
|
||||
URLAuthResultDefaultTypeID: "urlAuthResultDefault#a9d6db1f",
|
||||
ChannelLocationEmptyTypeID: "channelLocationEmpty#bfb5ad8b",
|
||||
@@ -1113,7 +1122,7 @@ func TypesMap() map[uint32]string {
|
||||
MessageViewsTypeID: "messageViews#455b853d",
|
||||
MessagesMessageViewsTypeID: "messages.messageViews#b6c4f543",
|
||||
MessagesDiscussionMessageTypeID: "messages.discussionMessage#a6341782",
|
||||
MessageReplyHeaderTypeID: "messageReplyHeader#6917560b",
|
||||
MessageReplyHeaderTypeID: "messageReplyHeader#1b97dd66",
|
||||
MessageReplyStoryHeaderTypeID: "messageReplyStoryHeader#e5af939",
|
||||
MessageRepliesTypeID: "messageReplies#83d60fc2",
|
||||
PeerBlockedTypeID: "peerBlocked#e8fd8014",
|
||||
@@ -1264,13 +1273,14 @@ func TypesMap() map[uint32]string {
|
||||
StickerKeywordTypeID: "stickerKeyword#fcfeb29c",
|
||||
UsernameTypeID: "username#b4073647",
|
||||
ForumTopicDeletedTypeID: "forumTopicDeleted#23f109b",
|
||||
ForumTopicTypeID: "forumTopic#cdff0eca",
|
||||
ForumTopicTypeID: "forumTopic#fcdad815",
|
||||
MessagesForumTopicsTypeID: "messages.forumTopics#367617d3",
|
||||
DefaultHistoryTTLTypeID: "defaultHistoryTTL#43b46b20",
|
||||
ExportedContactTokenTypeID: "exportedContactToken#41bf109b",
|
||||
RequestPeerTypeUserTypeID: "requestPeerTypeUser#5f3b8a00",
|
||||
RequestPeerTypeChatTypeID: "requestPeerTypeChat#c9f06e1b",
|
||||
RequestPeerTypeBroadcastTypeID: "requestPeerTypeBroadcast#339bef6c",
|
||||
RequestPeerTypeCreateBotTypeID: "requestPeerTypeCreateBot#3e81e078",
|
||||
EmojiListNotModifiedTypeID: "emojiListNotModified#481eadfa",
|
||||
EmojiListTypeID: "emojiList#7a1e11d1",
|
||||
EmojiGroupTypeID: "emojiGroup#7a9abda9",
|
||||
@@ -1306,7 +1316,7 @@ func TypesMap() map[uint32]string {
|
||||
StoryViewsTypeID: "storyViews#8d595cd6",
|
||||
StoryItemDeletedTypeID: "storyItemDeleted#51e6ee4f",
|
||||
StoryItemSkippedTypeID: "storyItemSkipped#ffadc913",
|
||||
StoryItemTypeID: "storyItem#edf164f1",
|
||||
StoryItemTypeID: "storyItem#16a4b93c",
|
||||
StoriesAllStoriesNotModifiedTypeID: "stories.allStoriesNotModified#1158fe3e",
|
||||
StoriesAllStoriesTypeID: "stories.allStories#6efc5e81",
|
||||
StoriesStoriesTypeID: "stories.stories#63c3dd0a",
|
||||
@@ -1315,7 +1325,7 @@ func TypesMap() map[uint32]string {
|
||||
StoryViewPublicRepostTypeID: "storyViewPublicRepost#bd74cf49",
|
||||
StoriesStoryViewsListTypeID: "stories.storyViewsList#59d78fc5",
|
||||
StoriesStoryViewsTypeID: "stories.storyViews#de9eed1d",
|
||||
InputReplyToMessageTypeID: "inputReplyToMessage#869fbe10",
|
||||
InputReplyToMessageTypeID: "inputReplyToMessage#3bd4b7c2",
|
||||
InputReplyToStoryTypeID: "inputReplyToStory#5881323a",
|
||||
InputReplyToMonoForumTypeID: "inputReplyToMonoForum#69d66c45",
|
||||
ExportedStoryLinkTypeID: "exportedStoryLink#3fc9053b",
|
||||
@@ -1425,7 +1435,7 @@ func TypesMap() map[uint32]string {
|
||||
ChannelsSponsoredMessageReportResultReportedTypeID: "channels.sponsoredMessageReportResultReported#ad798849",
|
||||
ReactionNotificationsFromContactsTypeID: "reactionNotificationsFromContacts#bac3a61a",
|
||||
ReactionNotificationsFromAllTypeID: "reactionNotificationsFromAll#4b9e22a0",
|
||||
ReactionsNotifySettingsTypeID: "reactionsNotifySettings#56e34970",
|
||||
ReactionsNotifySettingsTypeID: "reactionsNotifySettings#71e4ea58",
|
||||
AvailableEffectTypeID: "availableEffect#93c3e27e",
|
||||
MessagesAvailableEffectsNotModifiedTypeID: "messages.availableEffectsNotModified#d1ed9a5b",
|
||||
MessagesAvailableEffectsTypeID: "messages.availableEffects#bddb616e",
|
||||
@@ -1582,6 +1592,10 @@ func TypesMap() map[uint32]string {
|
||||
StarGiftAttributeRarityEpicTypeID: "starGiftAttributeRarityEpic#78fbf3a8",
|
||||
StarGiftAttributeRarityLegendaryTypeID: "starGiftAttributeRarityLegendary#cef7e7a8",
|
||||
KeyboardButtonStyleTypeID: "keyboardButtonStyle#4fdd3430",
|
||||
InputMessageReadMetricTypeID: "inputMessageReadMetric#402b4495",
|
||||
BotsExportedBotTokenTypeID: "bots.exportedBotToken#3c60b621",
|
||||
BotsRequestedButtonTypeID: "bots.requestedButton#f13bbcd7",
|
||||
MessagesComposedMessageWithAITypeID: "messages.composedMessageWithAI#90d7adfa",
|
||||
InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d",
|
||||
InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0",
|
||||
InitConnectionRequestTypeID: "initConnection#c1cd5ea9",
|
||||
@@ -1875,7 +1889,7 @@ func TypesMap() map[uint32]string {
|
||||
MessagesClearAllDraftsRequestTypeID: "messages.clearAllDrafts#7e58ee9c",
|
||||
MessagesUpdatePinnedMessageRequestTypeID: "messages.updatePinnedMessage#d2aaf7ec",
|
||||
MessagesSendVoteRequestTypeID: "messages.sendVote#10ea6184",
|
||||
MessagesGetPollResultsRequestTypeID: "messages.getPollResults#73bb643b",
|
||||
MessagesGetPollResultsRequestTypeID: "messages.getPollResults#eda3e33b",
|
||||
MessagesGetOnlinesRequestTypeID: "messages.getOnlines#6e2be050",
|
||||
MessagesEditChatAboutRequestTypeID: "messages.editChatAbout#def60797",
|
||||
MessagesEditChatDefaultBannedRightsRequestTypeID: "messages.editChatDefaultBannedRights#a5866b41",
|
||||
@@ -1931,7 +1945,7 @@ func TypesMap() map[uint32]string {
|
||||
MessagesSetChatAvailableReactionsRequestTypeID: "messages.setChatAvailableReactions#864b2581",
|
||||
MessagesGetAvailableReactionsRequestTypeID: "messages.getAvailableReactions#18dea0ac",
|
||||
MessagesSetDefaultReactionRequestTypeID: "messages.setDefaultReaction#4f47a016",
|
||||
MessagesTranslateTextRequestTypeID: "messages.translateText#63183030",
|
||||
MessagesTranslateTextRequestTypeID: "messages.translateText#a5eec345",
|
||||
MessagesGetUnreadReactionsRequestTypeID: "messages.getUnreadReactions#bd7f90ac",
|
||||
MessagesReadReactionsRequestTypeID: "messages.readReactions#9ec44f93",
|
||||
MessagesSearchSentMediaRequestTypeID: "messages.searchSentMedia#107e31a0",
|
||||
@@ -1955,7 +1969,7 @@ func TypesMap() map[uint32]string {
|
||||
MessagesGetExtendedMediaRequestTypeID: "messages.getExtendedMedia#84f80814",
|
||||
MessagesSetDefaultHistoryTTLRequestTypeID: "messages.setDefaultHistoryTTL#9eb51445",
|
||||
MessagesGetDefaultHistoryTTLRequestTypeID: "messages.getDefaultHistoryTTL#658b7188",
|
||||
MessagesSendBotRequestedPeerRequestTypeID: "messages.sendBotRequestedPeer#91b2d060",
|
||||
MessagesSendBotRequestedPeerRequestTypeID: "messages.sendBotRequestedPeer#6c5cf2a7",
|
||||
MessagesGetEmojiGroupsRequestTypeID: "messages.getEmojiGroups#7488ce5b",
|
||||
MessagesGetEmojiStatusGroupsRequestTypeID: "messages.getEmojiStatusGroups#2ecd56cd",
|
||||
MessagesGetEmojiProfilePhotoGroupsRequestTypeID: "messages.getEmojiProfilePhotoGroups#21a548f3",
|
||||
@@ -2015,12 +2029,19 @@ func TypesMap() map[uint32]string {
|
||||
MessagesCreateForumTopicRequestTypeID: "messages.createForumTopic#2f98c3d5",
|
||||
MessagesDeleteTopicHistoryRequestTypeID: "messages.deleteTopicHistory#d2816f10",
|
||||
MessagesGetEmojiGameInfoRequestTypeID: "messages.getEmojiGameInfo#fb7e8ca7",
|
||||
MessagesSummarizeTextRequestTypeID: "messages.summarizeText#9d4104e2",
|
||||
MessagesSummarizeTextRequestTypeID: "messages.summarizeText#abbbd346",
|
||||
MessagesEditChatCreatorRequestTypeID: "messages.editChatCreator#f743b857",
|
||||
MessagesGetFutureChatCreatorAfterLeaveRequestTypeID: "messages.getFutureChatCreatorAfterLeave#3b7d0ea6",
|
||||
MessagesEditChatParticipantRankRequestTypeID: "messages.editChatParticipantRank#a00f32b0",
|
||||
MessagesDeclineURLAuthRequestTypeID: "messages.declineUrlAuth#35436bbc",
|
||||
MessagesCheckURLAuthMatchCodeRequestTypeID: "messages.checkUrlAuthMatchCode#c9a47b0b",
|
||||
MessagesComposeMessageWithAIRequestTypeID: "messages.composeMessageWithAI#fd426afe",
|
||||
MessagesReportReadMetricsRequestTypeID: "messages.reportReadMetrics#4067c5e6",
|
||||
MessagesReportMusicListenRequestTypeID: "messages.reportMusicListen#ddbcd819",
|
||||
MessagesAddPollAnswerRequestTypeID: "messages.addPollAnswer#19bc4b6d",
|
||||
MessagesDeletePollAnswerRequestTypeID: "messages.deletePollAnswer#ac8505a5",
|
||||
MessagesGetUnreadPollVotesRequestTypeID: "messages.getUnreadPollVotes#43286cf2",
|
||||
MessagesReadPollVotesRequestTypeID: "messages.readPollVotes#1720b4d8",
|
||||
UpdatesGetStateRequestTypeID: "updates.getState#edd4882a",
|
||||
UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763",
|
||||
UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78",
|
||||
@@ -2150,6 +2171,11 @@ func TypesMap() map[uint32]string {
|
||||
BotsUpdateStarRefProgramRequestTypeID: "bots.updateStarRefProgram#778b5ab3",
|
||||
BotsSetCustomVerificationRequestTypeID: "bots.setCustomVerification#8b89dfbd",
|
||||
BotsGetBotRecommendationsRequestTypeID: "bots.getBotRecommendations#a1b70815",
|
||||
BotsCheckUsernameRequestTypeID: "bots.checkUsername#87f2219b",
|
||||
BotsCreateBotRequestTypeID: "bots.createBot#e5b17f2b",
|
||||
BotsExportBotTokenRequestTypeID: "bots.exportBotToken#bd0d99eb",
|
||||
BotsRequestWebViewButtonRequestTypeID: "bots.requestWebViewButton#31a2a35e",
|
||||
BotsGetRequestedWebViewButtonRequestTypeID: "bots.getRequestedWebViewButton#bf25b7f3",
|
||||
PaymentsGetPaymentFormRequestTypeID: "payments.getPaymentForm#37148dbb",
|
||||
PaymentsGetPaymentReceiptRequestTypeID: "payments.getPaymentReceipt#2478d1cc",
|
||||
PaymentsValidateRequestedInfoRequestTypeID: "payments.validateRequestedInfo#b6c8f12b",
|
||||
@@ -2294,8 +2320,8 @@ func TypesMap() map[uint32]string {
|
||||
ChatlistsGetLeaveChatlistSuggestionsRequestTypeID: "chatlists.getLeaveChatlistSuggestions#fdbcd714",
|
||||
ChatlistsLeaveChatlistRequestTypeID: "chatlists.leaveChatlist#74fae13a",
|
||||
StoriesCanSendStoryRequestTypeID: "stories.canSendStory#30eb63f0",
|
||||
StoriesSendStoryRequestTypeID: "stories.sendStory#737fc2ec",
|
||||
StoriesEditStoryRequestTypeID: "stories.editStory#b583ba46",
|
||||
StoriesSendStoryRequestTypeID: "stories.sendStory#8f9e6898",
|
||||
StoriesEditStoryRequestTypeID: "stories.editStory#2c63a72b",
|
||||
StoriesDeleteStoriesRequestTypeID: "stories.deleteStories#ae59db5f",
|
||||
StoriesTogglePinnedRequestTypeID: "stories.togglePinned#9a75a1ef",
|
||||
StoriesGetAllStoriesRequestTypeID: "stories.getAllStories#eeb0d625",
|
||||
@@ -2538,6 +2564,9 @@ func NamesMap() map[string]uint32 {
|
||||
"messageActionChangeCreator": MessageActionChangeCreatorTypeID,
|
||||
"messageActionNoForwardsToggle": MessageActionNoForwardsToggleTypeID,
|
||||
"messageActionNoForwardsRequest": MessageActionNoForwardsRequestTypeID,
|
||||
"messageActionPollAppendAnswer": MessageActionPollAppendAnswerTypeID,
|
||||
"messageActionPollDeleteAnswer": MessageActionPollDeleteAnswerTypeID,
|
||||
"messageActionManagedBotCreated": MessageActionManagedBotCreatedTypeID,
|
||||
"dialog": DialogTypeID,
|
||||
"dialogFolder": DialogFolderTypeID,
|
||||
"photoEmpty": PhotoEmptyTypeID,
|
||||
@@ -2613,6 +2642,7 @@ func NamesMap() map[string]uint32 {
|
||||
"inputMessagesFilterGeo": InputMessagesFilterGeoTypeID,
|
||||
"inputMessagesFilterContacts": InputMessagesFilterContactsTypeID,
|
||||
"inputMessagesFilterPinned": InputMessagesFilterPinnedTypeID,
|
||||
"inputMessagesFilterPoll": InputMessagesFilterPollTypeID,
|
||||
"updateNewMessage": UpdateNewMessageTypeID,
|
||||
"updateMessageID": UpdateMessageIDTypeID,
|
||||
"updateDeleteMessages": UpdateDeleteMessagesTypeID,
|
||||
@@ -2766,6 +2796,7 @@ func NamesMap() map[string]uint32 {
|
||||
"updateEmojiGameInfo": UpdateEmojiGameInfoTypeID,
|
||||
"updateStarGiftCraftFail": UpdateStarGiftCraftFailTypeID,
|
||||
"updateChatParticipantRank": UpdateChatParticipantRankTypeID,
|
||||
"updateManagedBot": UpdateManagedBotTypeID,
|
||||
"updates.state": UpdatesStateTypeID,
|
||||
"updates.differenceEmpty": UpdatesDifferenceEmptyTypeID,
|
||||
"updates.difference": UpdatesDifferenceTypeID,
|
||||
@@ -2983,6 +3014,9 @@ func NamesMap() map[string]uint32 {
|
||||
"messageEntityCustomEmoji": MessageEntityCustomEmojiTypeID,
|
||||
"messageEntityBlockquote": MessageEntityBlockquoteTypeID,
|
||||
"messageEntityFormattedDate": MessageEntityFormattedDateTypeID,
|
||||
"messageEntityDiffInsert": MessageEntityDiffInsertTypeID,
|
||||
"messageEntityDiffReplace": MessageEntityDiffReplaceTypeID,
|
||||
"messageEntityDiffDelete": MessageEntityDiffDeleteTypeID,
|
||||
"inputChannelEmpty": InputChannelEmptyTypeID,
|
||||
"inputChannel": InputChannelTypeID,
|
||||
"inputChannelFromMessage": InputChannelFromMessageTypeID,
|
||||
@@ -3347,6 +3381,7 @@ func NamesMap() map[string]uint32 {
|
||||
"help.userInfoEmpty": HelpUserInfoEmptyTypeID,
|
||||
"help.userInfo": HelpUserInfoTypeID,
|
||||
"pollAnswer": PollAnswerTypeID,
|
||||
"inputPollAnswer": InputPollAnswerTypeID,
|
||||
"poll": PollTypeID,
|
||||
"pollAnswerVoters": PollAnswerVotersTypeID,
|
||||
"pollResults": PollResultsTypeID,
|
||||
@@ -3592,6 +3627,7 @@ func NamesMap() map[string]uint32 {
|
||||
"requestPeerTypeUser": RequestPeerTypeUserTypeID,
|
||||
"requestPeerTypeChat": RequestPeerTypeChatTypeID,
|
||||
"requestPeerTypeBroadcast": RequestPeerTypeBroadcastTypeID,
|
||||
"requestPeerTypeCreateBot": RequestPeerTypeCreateBotTypeID,
|
||||
"emojiListNotModified": EmojiListNotModifiedTypeID,
|
||||
"emojiList": EmojiListTypeID,
|
||||
"emojiGroup": EmojiGroupTypeID,
|
||||
@@ -3903,6 +3939,10 @@ func NamesMap() map[string]uint32 {
|
||||
"starGiftAttributeRarityEpic": StarGiftAttributeRarityEpicTypeID,
|
||||
"starGiftAttributeRarityLegendary": StarGiftAttributeRarityLegendaryTypeID,
|
||||
"keyboardButtonStyle": KeyboardButtonStyleTypeID,
|
||||
"inputMessageReadMetric": InputMessageReadMetricTypeID,
|
||||
"bots.exportedBotToken": BotsExportedBotTokenTypeID,
|
||||
"bots.requestedButton": BotsRequestedButtonTypeID,
|
||||
"messages.composedMessageWithAI": MessagesComposedMessageWithAITypeID,
|
||||
"invokeAfterMsg": InvokeAfterMsgRequestTypeID,
|
||||
"invokeAfterMsgs": InvokeAfterMsgsRequestTypeID,
|
||||
"initConnection": InitConnectionRequestTypeID,
|
||||
@@ -4342,6 +4382,13 @@ func NamesMap() map[string]uint32 {
|
||||
"messages.editChatParticipantRank": MessagesEditChatParticipantRankRequestTypeID,
|
||||
"messages.declineUrlAuth": MessagesDeclineURLAuthRequestTypeID,
|
||||
"messages.checkUrlAuthMatchCode": MessagesCheckURLAuthMatchCodeRequestTypeID,
|
||||
"messages.composeMessageWithAI": MessagesComposeMessageWithAIRequestTypeID,
|
||||
"messages.reportReadMetrics": MessagesReportReadMetricsRequestTypeID,
|
||||
"messages.reportMusicListen": MessagesReportMusicListenRequestTypeID,
|
||||
"messages.addPollAnswer": MessagesAddPollAnswerRequestTypeID,
|
||||
"messages.deletePollAnswer": MessagesDeletePollAnswerRequestTypeID,
|
||||
"messages.getUnreadPollVotes": MessagesGetUnreadPollVotesRequestTypeID,
|
||||
"messages.readPollVotes": MessagesReadPollVotesRequestTypeID,
|
||||
"updates.getState": UpdatesGetStateRequestTypeID,
|
||||
"updates.getDifference": UpdatesGetDifferenceRequestTypeID,
|
||||
"updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID,
|
||||
@@ -4471,6 +4518,11 @@ func NamesMap() map[string]uint32 {
|
||||
"bots.updateStarRefProgram": BotsUpdateStarRefProgramRequestTypeID,
|
||||
"bots.setCustomVerification": BotsSetCustomVerificationRequestTypeID,
|
||||
"bots.getBotRecommendations": BotsGetBotRecommendationsRequestTypeID,
|
||||
"bots.checkUsername": BotsCheckUsernameRequestTypeID,
|
||||
"bots.createBot": BotsCreateBotRequestTypeID,
|
||||
"bots.exportBotToken": BotsExportBotTokenRequestTypeID,
|
||||
"bots.requestWebViewButton": BotsRequestWebViewButtonRequestTypeID,
|
||||
"bots.getRequestedWebViewButton": BotsGetRequestedWebViewButtonRequestTypeID,
|
||||
"payments.getPaymentForm": PaymentsGetPaymentFormRequestTypeID,
|
||||
"payments.getPaymentReceipt": PaymentsGetPaymentReceiptRequestTypeID,
|
||||
"payments.validateRequestedInfo": PaymentsValidateRequestedInfoRequestTypeID,
|
||||
@@ -4859,6 +4911,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessageActionChangeCreatorTypeID: func() bin.Object { return &MessageActionChangeCreator{} },
|
||||
MessageActionNoForwardsToggleTypeID: func() bin.Object { return &MessageActionNoForwardsToggle{} },
|
||||
MessageActionNoForwardsRequestTypeID: func() bin.Object { return &MessageActionNoForwardsRequest{} },
|
||||
MessageActionPollAppendAnswerTypeID: func() bin.Object { return &MessageActionPollAppendAnswer{} },
|
||||
MessageActionPollDeleteAnswerTypeID: func() bin.Object { return &MessageActionPollDeleteAnswer{} },
|
||||
MessageActionManagedBotCreatedTypeID: func() bin.Object { return &MessageActionManagedBotCreated{} },
|
||||
DialogTypeID: func() bin.Object { return &Dialog{} },
|
||||
DialogFolderTypeID: func() bin.Object { return &DialogFolder{} },
|
||||
PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} },
|
||||
@@ -4934,6 +4989,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
InputMessagesFilterGeoTypeID: func() bin.Object { return &InputMessagesFilterGeo{} },
|
||||
InputMessagesFilterContactsTypeID: func() bin.Object { return &InputMessagesFilterContacts{} },
|
||||
InputMessagesFilterPinnedTypeID: func() bin.Object { return &InputMessagesFilterPinned{} },
|
||||
InputMessagesFilterPollTypeID: func() bin.Object { return &InputMessagesFilterPoll{} },
|
||||
UpdateNewMessageTypeID: func() bin.Object { return &UpdateNewMessage{} },
|
||||
UpdateMessageIDTypeID: func() bin.Object { return &UpdateMessageID{} },
|
||||
UpdateDeleteMessagesTypeID: func() bin.Object { return &UpdateDeleteMessages{} },
|
||||
@@ -5087,6 +5143,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
UpdateEmojiGameInfoTypeID: func() bin.Object { return &UpdateEmojiGameInfo{} },
|
||||
UpdateStarGiftCraftFailTypeID: func() bin.Object { return &UpdateStarGiftCraftFail{} },
|
||||
UpdateChatParticipantRankTypeID: func() bin.Object { return &UpdateChatParticipantRank{} },
|
||||
UpdateManagedBotTypeID: func() bin.Object { return &UpdateManagedBot{} },
|
||||
UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} },
|
||||
UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} },
|
||||
UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} },
|
||||
@@ -5304,6 +5361,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessageEntityCustomEmojiTypeID: func() bin.Object { return &MessageEntityCustomEmoji{} },
|
||||
MessageEntityBlockquoteTypeID: func() bin.Object { return &MessageEntityBlockquote{} },
|
||||
MessageEntityFormattedDateTypeID: func() bin.Object { return &MessageEntityFormattedDate{} },
|
||||
MessageEntityDiffInsertTypeID: func() bin.Object { return &MessageEntityDiffInsert{} },
|
||||
MessageEntityDiffReplaceTypeID: func() bin.Object { return &MessageEntityDiffReplace{} },
|
||||
MessageEntityDiffDeleteTypeID: func() bin.Object { return &MessageEntityDiffDelete{} },
|
||||
InputChannelEmptyTypeID: func() bin.Object { return &InputChannelEmpty{} },
|
||||
InputChannelTypeID: func() bin.Object { return &InputChannel{} },
|
||||
InputChannelFromMessageTypeID: func() bin.Object { return &InputChannelFromMessage{} },
|
||||
@@ -5668,6 +5728,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
HelpUserInfoEmptyTypeID: func() bin.Object { return &HelpUserInfoEmpty{} },
|
||||
HelpUserInfoTypeID: func() bin.Object { return &HelpUserInfo{} },
|
||||
PollAnswerTypeID: func() bin.Object { return &PollAnswer{} },
|
||||
InputPollAnswerTypeID: func() bin.Object { return &InputPollAnswer{} },
|
||||
PollTypeID: func() bin.Object { return &Poll{} },
|
||||
PollAnswerVotersTypeID: func() bin.Object { return &PollAnswerVoters{} },
|
||||
PollResultsTypeID: func() bin.Object { return &PollResults{} },
|
||||
@@ -5913,6 +5974,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
RequestPeerTypeUserTypeID: func() bin.Object { return &RequestPeerTypeUser{} },
|
||||
RequestPeerTypeChatTypeID: func() bin.Object { return &RequestPeerTypeChat{} },
|
||||
RequestPeerTypeBroadcastTypeID: func() bin.Object { return &RequestPeerTypeBroadcast{} },
|
||||
RequestPeerTypeCreateBotTypeID: func() bin.Object { return &RequestPeerTypeCreateBot{} },
|
||||
EmojiListNotModifiedTypeID: func() bin.Object { return &EmojiListNotModified{} },
|
||||
EmojiListTypeID: func() bin.Object { return &EmojiList{} },
|
||||
EmojiGroupTypeID: func() bin.Object { return &EmojiGroup{} },
|
||||
@@ -6224,6 +6286,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
StarGiftAttributeRarityEpicTypeID: func() bin.Object { return &StarGiftAttributeRarityEpic{} },
|
||||
StarGiftAttributeRarityLegendaryTypeID: func() bin.Object { return &StarGiftAttributeRarityLegendary{} },
|
||||
KeyboardButtonStyleTypeID: func() bin.Object { return &KeyboardButtonStyle{} },
|
||||
InputMessageReadMetricTypeID: func() bin.Object { return &InputMessageReadMetric{} },
|
||||
BotsExportedBotTokenTypeID: func() bin.Object { return &BotsExportedBotToken{} },
|
||||
BotsRequestedButtonTypeID: func() bin.Object { return &BotsRequestedButton{} },
|
||||
MessagesComposedMessageWithAITypeID: func() bin.Object { return &MessagesComposedMessageWithAI{} },
|
||||
InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} },
|
||||
InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} },
|
||||
InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} },
|
||||
@@ -6663,6 +6729,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessagesEditChatParticipantRankRequestTypeID: func() bin.Object { return &MessagesEditChatParticipantRankRequest{} },
|
||||
MessagesDeclineURLAuthRequestTypeID: func() bin.Object { return &MessagesDeclineURLAuthRequest{} },
|
||||
MessagesCheckURLAuthMatchCodeRequestTypeID: func() bin.Object { return &MessagesCheckURLAuthMatchCodeRequest{} },
|
||||
MessagesComposeMessageWithAIRequestTypeID: func() bin.Object { return &MessagesComposeMessageWithAIRequest{} },
|
||||
MessagesReportReadMetricsRequestTypeID: func() bin.Object { return &MessagesReportReadMetricsRequest{} },
|
||||
MessagesReportMusicListenRequestTypeID: func() bin.Object { return &MessagesReportMusicListenRequest{} },
|
||||
MessagesAddPollAnswerRequestTypeID: func() bin.Object { return &MessagesAddPollAnswerRequest{} },
|
||||
MessagesDeletePollAnswerRequestTypeID: func() bin.Object { return &MessagesDeletePollAnswerRequest{} },
|
||||
MessagesGetUnreadPollVotesRequestTypeID: func() bin.Object { return &MessagesGetUnreadPollVotesRequest{} },
|
||||
MessagesReadPollVotesRequestTypeID: func() bin.Object { return &MessagesReadPollVotesRequest{} },
|
||||
UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} },
|
||||
UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} },
|
||||
UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} },
|
||||
@@ -6792,6 +6865,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
BotsUpdateStarRefProgramRequestTypeID: func() bin.Object { return &BotsUpdateStarRefProgramRequest{} },
|
||||
BotsSetCustomVerificationRequestTypeID: func() bin.Object { return &BotsSetCustomVerificationRequest{} },
|
||||
BotsGetBotRecommendationsRequestTypeID: func() bin.Object { return &BotsGetBotRecommendationsRequest{} },
|
||||
BotsCheckUsernameRequestTypeID: func() bin.Object { return &BotsCheckUsernameRequest{} },
|
||||
BotsCreateBotRequestTypeID: func() bin.Object { return &BotsCreateBotRequest{} },
|
||||
BotsExportBotTokenRequestTypeID: func() bin.Object { return &BotsExportBotTokenRequest{} },
|
||||
BotsRequestWebViewButtonRequestTypeID: func() bin.Object { return &BotsRequestWebViewButtonRequest{} },
|
||||
BotsGetRequestedWebViewButtonRequestTypeID: func() bin.Object { return &BotsGetRequestedWebViewButtonRequest{} },
|
||||
PaymentsGetPaymentFormRequestTypeID: func() bin.Object { return &PaymentsGetPaymentFormRequest{} },
|
||||
PaymentsGetPaymentReceiptRequestTypeID: func() bin.Object { return &PaymentsGetPaymentReceiptRequest{} },
|
||||
PaymentsValidateRequestedInfoRequestTypeID: func() bin.Object { return &PaymentsValidateRequestedInfoRequest{} },
|
||||
@@ -7805,6 +7883,9 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
MessageActionChangeCreatorTypeID,
|
||||
MessageActionNoForwardsToggleTypeID,
|
||||
MessageActionNoForwardsRequestTypeID,
|
||||
MessageActionPollAppendAnswerTypeID,
|
||||
MessageActionPollDeleteAnswerTypeID,
|
||||
MessageActionManagedBotCreatedTypeID,
|
||||
},
|
||||
MessageClassName: {
|
||||
MessageEmptyTypeID,
|
||||
@@ -7834,6 +7915,9 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
MessageEntityCustomEmojiTypeID,
|
||||
MessageEntityBlockquoteTypeID,
|
||||
MessageEntityFormattedDateTypeID,
|
||||
MessageEntityDiffInsertTypeID,
|
||||
MessageEntityDiffReplaceTypeID,
|
||||
MessageEntityDiffDeleteTypeID,
|
||||
},
|
||||
MessageExtendedMediaClassName: {
|
||||
MessageExtendedMediaPreviewTypeID,
|
||||
@@ -7932,6 +8016,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
InputMessagesFilterGeoTypeID,
|
||||
InputMessagesFilterContactsTypeID,
|
||||
InputMessagesFilterPinnedTypeID,
|
||||
InputMessagesFilterPollTypeID,
|
||||
},
|
||||
MessagesFoundStickerSetsClassName: {
|
||||
MessagesFoundStickerSetsNotModifiedTypeID,
|
||||
@@ -8135,6 +8220,10 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
PhotosPhotosTypeID,
|
||||
PhotosPhotosSliceTypeID,
|
||||
},
|
||||
PollAnswerClassName: {
|
||||
PollAnswerTypeID,
|
||||
InputPollAnswerTypeID,
|
||||
},
|
||||
PostInteractionCountersClassName: {
|
||||
PostInteractionCountersMessageTypeID,
|
||||
PostInteractionCountersStoryTypeID,
|
||||
@@ -8231,6 +8320,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
RequestPeerTypeUserTypeID,
|
||||
RequestPeerTypeChatTypeID,
|
||||
RequestPeerTypeBroadcastTypeID,
|
||||
RequestPeerTypeCreateBotTypeID,
|
||||
},
|
||||
RequestedPeerClassName: {
|
||||
RequestedPeerUserTypeID,
|
||||
@@ -8589,6 +8679,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
UpdateEmojiGameInfoTypeID,
|
||||
UpdateStarGiftCraftFailTypeID,
|
||||
UpdateChatParticipantRankTypeID,
|
||||
UpdateManagedBotTypeID,
|
||||
},
|
||||
UpdatesChannelDifferenceClassName: {
|
||||
UpdatesChannelDifferenceEmptyTypeID,
|
||||
|
||||
Generated
+264
@@ -976,6 +976,262 @@ func (r *RequestPeerTypeBroadcast) GetBotAdminRights() (value ChatAdminRights, o
|
||||
return r.BotAdminRights, true
|
||||
}
|
||||
|
||||
// RequestPeerTypeCreateBot represents TL type `requestPeerTypeCreateBot#3e81e078`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/requestPeerTypeCreateBot for reference.
|
||||
type RequestPeerTypeCreateBot struct {
|
||||
// Flags field of RequestPeerTypeCreateBot.
|
||||
Flags bin.Fields
|
||||
// BotManaged field of RequestPeerTypeCreateBot.
|
||||
BotManaged bool
|
||||
// SuggestedName field of RequestPeerTypeCreateBot.
|
||||
//
|
||||
// Use SetSuggestedName and GetSuggestedName helpers.
|
||||
SuggestedName string
|
||||
// SuggestedUsername field of RequestPeerTypeCreateBot.
|
||||
//
|
||||
// Use SetSuggestedUsername and GetSuggestedUsername helpers.
|
||||
SuggestedUsername string
|
||||
}
|
||||
|
||||
// RequestPeerTypeCreateBotTypeID is TL type id of RequestPeerTypeCreateBot.
|
||||
const RequestPeerTypeCreateBotTypeID = 0x3e81e078
|
||||
|
||||
// construct implements constructor of RequestPeerTypeClass.
|
||||
func (r RequestPeerTypeCreateBot) construct() RequestPeerTypeClass { return &r }
|
||||
|
||||
// Ensuring interfaces in compile-time for RequestPeerTypeCreateBot.
|
||||
var (
|
||||
_ bin.Encoder = &RequestPeerTypeCreateBot{}
|
||||
_ bin.Decoder = &RequestPeerTypeCreateBot{}
|
||||
_ bin.BareEncoder = &RequestPeerTypeCreateBot{}
|
||||
_ bin.BareDecoder = &RequestPeerTypeCreateBot{}
|
||||
|
||||
_ RequestPeerTypeClass = &RequestPeerTypeCreateBot{}
|
||||
)
|
||||
|
||||
func (r *RequestPeerTypeCreateBot) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(r.BotManaged == false) {
|
||||
return false
|
||||
}
|
||||
if !(r.SuggestedName == "") {
|
||||
return false
|
||||
}
|
||||
if !(r.SuggestedUsername == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RequestPeerTypeCreateBot) String() string {
|
||||
if r == nil {
|
||||
return "RequestPeerTypeCreateBot(nil)"
|
||||
}
|
||||
type Alias RequestPeerTypeCreateBot
|
||||
return fmt.Sprintf("RequestPeerTypeCreateBot%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills RequestPeerTypeCreateBot from given interface.
|
||||
func (r *RequestPeerTypeCreateBot) FillFrom(from interface {
|
||||
GetBotManaged() (value bool)
|
||||
GetSuggestedName() (value string, ok bool)
|
||||
GetSuggestedUsername() (value string, ok bool)
|
||||
}) {
|
||||
r.BotManaged = from.GetBotManaged()
|
||||
if val, ok := from.GetSuggestedName(); ok {
|
||||
r.SuggestedName = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSuggestedUsername(); ok {
|
||||
r.SuggestedUsername = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RequestPeerTypeCreateBot) TypeID() uint32 {
|
||||
return RequestPeerTypeCreateBotTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RequestPeerTypeCreateBot) TypeName() string {
|
||||
return "requestPeerTypeCreateBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RequestPeerTypeCreateBot) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "requestPeerTypeCreateBot",
|
||||
ID: RequestPeerTypeCreateBotTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotManaged",
|
||||
SchemaName: "bot_managed",
|
||||
Null: !r.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "SuggestedName",
|
||||
SchemaName: "suggested_name",
|
||||
Null: !r.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "SuggestedUsername",
|
||||
SchemaName: "suggested_username",
|
||||
Null: !r.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (r *RequestPeerTypeCreateBot) SetFlags() {
|
||||
if !(r.BotManaged == false) {
|
||||
r.Flags.Set(0)
|
||||
}
|
||||
if !(r.SuggestedName == "") {
|
||||
r.Flags.Set(1)
|
||||
}
|
||||
if !(r.SuggestedUsername == "") {
|
||||
r.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RequestPeerTypeCreateBot) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode requestPeerTypeCreateBot#3e81e078 as nil")
|
||||
}
|
||||
b.PutID(RequestPeerTypeCreateBotTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RequestPeerTypeCreateBot) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode requestPeerTypeCreateBot#3e81e078 as nil")
|
||||
}
|
||||
r.SetFlags()
|
||||
if err := r.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode requestPeerTypeCreateBot#3e81e078: field flags: %w", err)
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
b.PutString(r.SuggestedName)
|
||||
}
|
||||
if r.Flags.Has(2) {
|
||||
b.PutString(r.SuggestedUsername)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RequestPeerTypeCreateBot) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode requestPeerTypeCreateBot#3e81e078 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RequestPeerTypeCreateBotTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode requestPeerTypeCreateBot#3e81e078: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RequestPeerTypeCreateBot) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode requestPeerTypeCreateBot#3e81e078 to nil")
|
||||
}
|
||||
{
|
||||
if err := r.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode requestPeerTypeCreateBot#3e81e078: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
r.BotManaged = r.Flags.Has(0)
|
||||
if r.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode requestPeerTypeCreateBot#3e81e078: field suggested_name: %w", err)
|
||||
}
|
||||
r.SuggestedName = value
|
||||
}
|
||||
if r.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode requestPeerTypeCreateBot#3e81e078: field suggested_username: %w", err)
|
||||
}
|
||||
r.SuggestedUsername = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetBotManaged sets value of BotManaged conditional field.
|
||||
func (r *RequestPeerTypeCreateBot) SetBotManaged(value bool) {
|
||||
if value {
|
||||
r.Flags.Set(0)
|
||||
r.BotManaged = true
|
||||
} else {
|
||||
r.Flags.Unset(0)
|
||||
r.BotManaged = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetBotManaged returns value of BotManaged conditional field.
|
||||
func (r *RequestPeerTypeCreateBot) GetBotManaged() (value bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetSuggestedName sets value of SuggestedName conditional field.
|
||||
func (r *RequestPeerTypeCreateBot) SetSuggestedName(value string) {
|
||||
r.Flags.Set(1)
|
||||
r.SuggestedName = value
|
||||
}
|
||||
|
||||
// GetSuggestedName returns value of SuggestedName conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (r *RequestPeerTypeCreateBot) GetSuggestedName() (value string, ok bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if !r.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return r.SuggestedName, true
|
||||
}
|
||||
|
||||
// SetSuggestedUsername sets value of SuggestedUsername conditional field.
|
||||
func (r *RequestPeerTypeCreateBot) SetSuggestedUsername(value string) {
|
||||
r.Flags.Set(2)
|
||||
r.SuggestedUsername = value
|
||||
}
|
||||
|
||||
// GetSuggestedUsername returns value of SuggestedUsername conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (r *RequestPeerTypeCreateBot) GetSuggestedUsername() (value string, ok bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if !r.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return r.SuggestedUsername, true
|
||||
}
|
||||
|
||||
// RequestPeerTypeClassName is schema name of RequestPeerTypeClass.
|
||||
const RequestPeerTypeClassName = "RequestPeerType"
|
||||
|
||||
@@ -993,6 +1249,7 @@ const RequestPeerTypeClassName = "RequestPeerType"
|
||||
// case *tg.RequestPeerTypeUser: // requestPeerTypeUser#5f3b8a00
|
||||
// case *tg.RequestPeerTypeChat: // requestPeerTypeChat#c9f06e1b
|
||||
// case *tg.RequestPeerTypeBroadcast: // requestPeerTypeBroadcast#339bef6c
|
||||
// case *tg.RequestPeerTypeCreateBot: // requestPeerTypeCreateBot#3e81e078
|
||||
// default: panic(v)
|
||||
// }
|
||||
type RequestPeerTypeClass interface {
|
||||
@@ -1042,6 +1299,13 @@ func DecodeRequestPeerType(buf *bin.Buffer) (RequestPeerTypeClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode RequestPeerTypeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case RequestPeerTypeCreateBotTypeID:
|
||||
// Decoding requestPeerTypeCreateBot#3e81e078.
|
||||
v := RequestPeerTypeCreateBot{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode RequestPeerTypeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode RequestPeerTypeClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
+95
@@ -155,6 +155,19 @@ func (s RequestPeerTypeClassArray) AsRequestPeerTypeBroadcast() (to RequestPeerT
|
||||
return to
|
||||
}
|
||||
|
||||
// AsRequestPeerTypeCreateBot returns copy with only RequestPeerTypeCreateBot constructors.
|
||||
func (s RequestPeerTypeClassArray) AsRequestPeerTypeCreateBot() (to RequestPeerTypeCreateBotArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*RequestPeerTypeCreateBot)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// RequestPeerTypeUserArray is adapter for slice of RequestPeerTypeUser.
|
||||
type RequestPeerTypeUserArray []RequestPeerTypeUser
|
||||
|
||||
@@ -400,3 +413,85 @@ func (s *RequestPeerTypeBroadcastArray) Pop() (v RequestPeerTypeBroadcast, ok bo
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// RequestPeerTypeCreateBotArray is adapter for slice of RequestPeerTypeCreateBot.
|
||||
type RequestPeerTypeCreateBotArray []RequestPeerTypeCreateBot
|
||||
|
||||
// Sort sorts slice of RequestPeerTypeCreateBot.
|
||||
func (s RequestPeerTypeCreateBotArray) Sort(less func(a, b RequestPeerTypeCreateBot) bool) RequestPeerTypeCreateBotArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of RequestPeerTypeCreateBot.
|
||||
func (s RequestPeerTypeCreateBotArray) SortStable(less func(a, b RequestPeerTypeCreateBot) bool) RequestPeerTypeCreateBotArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of RequestPeerTypeCreateBot.
|
||||
func (s RequestPeerTypeCreateBotArray) Retain(keep func(x RequestPeerTypeCreateBot) bool) RequestPeerTypeCreateBotArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s RequestPeerTypeCreateBotArray) First() (v RequestPeerTypeCreateBot, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s RequestPeerTypeCreateBotArray) Last() (v RequestPeerTypeCreateBot, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *RequestPeerTypeCreateBotArray) PopFirst() (v RequestPeerTypeCreateBot, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero RequestPeerTypeCreateBot
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *RequestPeerTypeCreateBotArray) Pop() (v RequestPeerTypeCreateBot, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
Generated
+216
@@ -7869,6 +7869,133 @@ func (s *ServerDispatcher) OnMessagesCheckURLAuthMatchCode(f func(ctx context.Co
|
||||
s.handlers[MessagesCheckURLAuthMatchCodeRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesComposeMessageWithAI(f func(ctx context.Context, request *MessagesComposeMessageWithAIRequest) (*MessagesComposedMessageWithAI, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesComposeMessageWithAIRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesComposeMessageWithAIRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesReportReadMetrics(f func(ctx context.Context, request *MessagesReportReadMetricsRequest) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesReportReadMetricsRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesReportReadMetricsRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesReportMusicListen(f func(ctx context.Context, request *MessagesReportMusicListenRequest) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesReportMusicListenRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesReportMusicListenRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesAddPollAnswer(f func(ctx context.Context, request *MessagesAddPollAnswerRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesAddPollAnswerRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesAddPollAnswerRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesDeletePollAnswer(f func(ctx context.Context, request *MessagesDeletePollAnswerRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesDeletePollAnswerRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesDeletePollAnswerRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesGetUnreadPollVotes(f func(ctx context.Context, request *MessagesGetUnreadPollVotesRequest) (MessagesMessagesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesGetUnreadPollVotesRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &MessagesMessagesBox{Messages: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesGetUnreadPollVotesRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesReadPollVotes(f func(ctx context.Context, request *MessagesReadPollVotesRequest) (*MessagesAffectedHistory, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesReadPollVotesRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesReadPollVotesRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request UpdatesGetStateRequest
|
||||
@@ -10210,6 +10337,95 @@ func (s *ServerDispatcher) OnBotsGetBotRecommendations(f func(ctx context.Contex
|
||||
s.handlers[BotsGetBotRecommendationsRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnBotsCheckUsername(f func(ctx context.Context, username string) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request BotsCheckUsernameRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.Username)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[BotsCheckUsernameRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnBotsCreateBot(f func(ctx context.Context, request *BotsCreateBotRequest) (UserClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request BotsCreateBotRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UserBox{User: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[BotsCreateBotRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnBotsExportBotToken(f func(ctx context.Context, request *BotsExportBotTokenRequest) (*BotsExportedBotToken, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request BotsExportBotTokenRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[BotsExportBotTokenRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnBotsRequestWebViewButton(f func(ctx context.Context, request *BotsRequestWebViewButtonRequest) (*BotsRequestedButton, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request BotsRequestWebViewButtonRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[BotsRequestWebViewButtonRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnBotsGetRequestedWebViewButton(f func(ctx context.Context, request *BotsGetRequestedWebViewButtonRequest) (KeyboardButtonClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request BotsGetRequestedWebViewButtonRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &KeyboardButtonBox{KeyboardButton: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[BotsGetRequestedWebViewButtonRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsGetPaymentForm(f func(ctx context.Context, request *PaymentsGetPaymentFormRequest) (PaymentsPaymentFormClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsGetPaymentFormRequest
|
||||
|
||||
Generated
+92
-30
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// StoriesEditStoryRequest represents TL type `stories.editStory#b583ba46`.
|
||||
// StoriesEditStoryRequest represents TL type `stories.editStory#2c63a72b`.
|
||||
// Edit an uploaded story¹
|
||||
// May also be used in a business connection¹, not by wrapping the query in
|
||||
// invokeWithBusinessConnection »², but rather by specifying the ID of a controlled
|
||||
@@ -88,10 +88,14 @@ type StoriesEditStoryRequest struct {
|
||||
//
|
||||
// Use SetPrivacyRules and GetPrivacyRules helpers.
|
||||
PrivacyRules []InputPrivacyRuleClass
|
||||
// Music field of StoriesEditStoryRequest.
|
||||
//
|
||||
// Use SetMusic and GetMusic helpers.
|
||||
Music InputDocumentClass
|
||||
}
|
||||
|
||||
// StoriesEditStoryRequestTypeID is TL type id of StoriesEditStoryRequest.
|
||||
const StoriesEditStoryRequestTypeID = 0xb583ba46
|
||||
const StoriesEditStoryRequestTypeID = 0x2c63a72b
|
||||
|
||||
// Ensuring interfaces in compile-time for StoriesEditStoryRequest.
|
||||
var (
|
||||
@@ -129,6 +133,9 @@ func (e *StoriesEditStoryRequest) Zero() bool {
|
||||
if !(e.PrivacyRules == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Music == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -151,6 +158,7 @@ func (e *StoriesEditStoryRequest) FillFrom(from interface {
|
||||
GetCaption() (value string, ok bool)
|
||||
GetEntities() (value []MessageEntityClass, ok bool)
|
||||
GetPrivacyRules() (value []InputPrivacyRuleClass, ok bool)
|
||||
GetMusic() (value InputDocumentClass, ok bool)
|
||||
}) {
|
||||
e.Peer = from.GetPeer()
|
||||
e.ID = from.GetID()
|
||||
@@ -174,6 +182,10 @@ func (e *StoriesEditStoryRequest) FillFrom(from interface {
|
||||
e.PrivacyRules = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetMusic(); ok {
|
||||
e.Music = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -232,6 +244,11 @@ func (e *StoriesEditStoryRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "privacy_rules",
|
||||
Null: !e.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "Music",
|
||||
SchemaName: "music",
|
||||
Null: !e.Flags.Has(4),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -253,12 +270,15 @@ func (e *StoriesEditStoryRequest) SetFlags() {
|
||||
if !(e.PrivacyRules == nil) {
|
||||
e.Flags.Set(2)
|
||||
}
|
||||
if !(e.Music == nil) {
|
||||
e.Flags.Set(4)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *StoriesEditStoryRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode stories.editStory#b583ba46 as nil")
|
||||
return fmt.Errorf("can't encode stories.editStory#2c63a72b as nil")
|
||||
}
|
||||
b.PutID(StoriesEditStoryRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
@@ -267,35 +287,35 @@ func (e *StoriesEditStoryRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *StoriesEditStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode stories.editStory#b583ba46 as nil")
|
||||
return fmt.Errorf("can't encode stories.editStory#2c63a72b as nil")
|
||||
}
|
||||
e.SetFlags()
|
||||
if err := e.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field flags: %w", err)
|
||||
}
|
||||
if e.Peer == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field peer is nil")
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field peer is nil")
|
||||
}
|
||||
if err := e.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(e.ID)
|
||||
if e.Flags.Has(0) {
|
||||
if e.Media == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field media is nil")
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field media is nil")
|
||||
}
|
||||
if err := e.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field media: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field media: %w", err)
|
||||
}
|
||||
}
|
||||
if e.Flags.Has(3) {
|
||||
b.PutVectorHeader(len(e.MediaAreas))
|
||||
for idx, v := range e.MediaAreas {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field media_areas element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field media_areas element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field media_areas element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field media_areas element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,10 +326,10 @@ func (e *StoriesEditStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(e.Entities))
|
||||
for idx, v := range e.Entities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,23 +337,31 @@ func (e *StoriesEditStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(e.PrivacyRules))
|
||||
for idx, v := range e.PrivacyRules {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field privacy_rules element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field privacy_rules element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#b583ba46: field privacy_rules element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field privacy_rules element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if e.Flags.Has(4) {
|
||||
if e.Music == nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field music is nil")
|
||||
}
|
||||
if err := e.Music.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.editStory#2c63a72b: field music: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *StoriesEditStoryRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode stories.editStory#b583ba46 to nil")
|
||||
return fmt.Errorf("can't decode stories.editStory#2c63a72b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StoriesEditStoryRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
@@ -341,38 +369,38 @@ func (e *StoriesEditStoryRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode stories.editStory#b583ba46 to nil")
|
||||
return fmt.Errorf("can't decode stories.editStory#2c63a72b to nil")
|
||||
}
|
||||
{
|
||||
if err := e.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field peer: %w", err)
|
||||
}
|
||||
e.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field id: %w", err)
|
||||
}
|
||||
e.ID = value
|
||||
}
|
||||
if e.Flags.Has(0) {
|
||||
value, err := DecodeInputMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field media: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field media: %w", err)
|
||||
}
|
||||
e.Media = value
|
||||
}
|
||||
if e.Flags.Has(3) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field media_areas: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -381,7 +409,7 @@ func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMediaArea(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field media_areas: %w", err)
|
||||
}
|
||||
e.MediaAreas = append(e.MediaAreas, value)
|
||||
}
|
||||
@@ -389,14 +417,14 @@ func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field caption: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field caption: %w", err)
|
||||
}
|
||||
e.Caption = value
|
||||
}
|
||||
if e.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -405,7 +433,7 @@ func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field entities: %w", err)
|
||||
}
|
||||
e.Entities = append(e.Entities, value)
|
||||
}
|
||||
@@ -413,7 +441,7 @@ func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e.Flags.Has(2) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field privacy_rules: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field privacy_rules: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -422,11 +450,18 @@ func (e *StoriesEditStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeInputPrivacyRule(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#b583ba46: field privacy_rules: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field privacy_rules: %w", err)
|
||||
}
|
||||
e.PrivacyRules = append(e.PrivacyRules, value)
|
||||
}
|
||||
}
|
||||
if e.Flags.Has(4) {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.editStory#2c63a72b: field music: %w", err)
|
||||
}
|
||||
e.Music = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -536,6 +571,24 @@ func (e *StoriesEditStoryRequest) GetPrivacyRules() (value []InputPrivacyRuleCla
|
||||
return e.PrivacyRules, true
|
||||
}
|
||||
|
||||
// SetMusic sets value of Music conditional field.
|
||||
func (e *StoriesEditStoryRequest) SetMusic(value InputDocumentClass) {
|
||||
e.Flags.Set(4)
|
||||
e.Music = value
|
||||
}
|
||||
|
||||
// GetMusic returns value of Music conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (e *StoriesEditStoryRequest) GetMusic() (value InputDocumentClass, ok bool) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
if !e.Flags.Has(4) {
|
||||
return value, false
|
||||
}
|
||||
return e.Music, true
|
||||
}
|
||||
|
||||
// MapMediaAreas returns field MediaAreas wrapped in MediaAreaClassArray helper.
|
||||
func (e *StoriesEditStoryRequest) MapMediaAreas() (value MediaAreaClassArray, ok bool) {
|
||||
if !e.Flags.Has(3) {
|
||||
@@ -560,7 +613,16 @@ func (e *StoriesEditStoryRequest) MapPrivacyRules() (value InputPrivacyRuleClass
|
||||
return InputPrivacyRuleClassArray(e.PrivacyRules), true
|
||||
}
|
||||
|
||||
// StoriesEditStory invokes method stories.editStory#b583ba46 returning error if any.
|
||||
// GetMusicAsNotEmpty returns mapped value of Music conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (e *StoriesEditStoryRequest) GetMusicAsNotEmpty() (*InputDocument, bool) {
|
||||
if value, ok := e.GetMusic(); ok {
|
||||
return value.AsNotEmpty()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// StoriesEditStory invokes method stories.editStory#2c63a72b returning error if any.
|
||||
// Edit an uploaded story¹
|
||||
// May also be used in a business connection¹, not by wrapping the query in
|
||||
// invokeWithBusinessConnection »², but rather by specifying the ID of a controlled
|
||||
|
||||
Generated
+99
-37
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// StoriesSendStoryRequest represents TL type `stories.sendStory#737fc2ec`.
|
||||
// StoriesSendStoryRequest represents TL type `stories.sendStory#8f9e6898`.
|
||||
// Uploads a Telegram Story¹.
|
||||
// May also be used in a business connection¹, not by wrapping the query in
|
||||
// invokeWithBusinessConnection »², but rather by specifying the ID of a controlled
|
||||
@@ -112,10 +112,14 @@ type StoriesSendStoryRequest struct {
|
||||
//
|
||||
// Use SetAlbums and GetAlbums helpers.
|
||||
Albums []int
|
||||
// Music field of StoriesSendStoryRequest.
|
||||
//
|
||||
// Use SetMusic and GetMusic helpers.
|
||||
Music InputDocumentClass
|
||||
}
|
||||
|
||||
// StoriesSendStoryRequestTypeID is TL type id of StoriesSendStoryRequest.
|
||||
const StoriesSendStoryRequestTypeID = 0x737fc2ec
|
||||
const StoriesSendStoryRequestTypeID = 0x8f9e6898
|
||||
|
||||
// Ensuring interfaces in compile-time for StoriesSendStoryRequest.
|
||||
var (
|
||||
@@ -174,6 +178,9 @@ func (s *StoriesSendStoryRequest) Zero() bool {
|
||||
if !(s.Albums == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Music == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -203,6 +210,7 @@ func (s *StoriesSendStoryRequest) FillFrom(from interface {
|
||||
GetFwdFromID() (value InputPeerClass, ok bool)
|
||||
GetFwdFromStory() (value int, ok bool)
|
||||
GetAlbums() (value []int, ok bool)
|
||||
GetMusic() (value InputDocumentClass, ok bool)
|
||||
}) {
|
||||
s.Pinned = from.GetPinned()
|
||||
s.Noforwards = from.GetNoforwards()
|
||||
@@ -239,6 +247,10 @@ func (s *StoriesSendStoryRequest) FillFrom(from interface {
|
||||
s.Albums = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetMusic(); ok {
|
||||
s.Music = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -330,6 +342,11 @@ func (s *StoriesSendStoryRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "albums",
|
||||
Null: !s.Flags.Has(8),
|
||||
},
|
||||
{
|
||||
Name: "Music",
|
||||
SchemaName: "music",
|
||||
Null: !s.Flags.Has(9),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -366,12 +383,15 @@ func (s *StoriesSendStoryRequest) SetFlags() {
|
||||
if !(s.Albums == nil) {
|
||||
s.Flags.Set(8)
|
||||
}
|
||||
if !(s.Music == nil) {
|
||||
s.Flags.Set(9)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StoriesSendStoryRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode stories.sendStory#737fc2ec as nil")
|
||||
return fmt.Errorf("can't encode stories.sendStory#8f9e6898 as nil")
|
||||
}
|
||||
b.PutID(StoriesSendStoryRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -380,32 +400,32 @@ func (s *StoriesSendStoryRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StoriesSendStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode stories.sendStory#737fc2ec as nil")
|
||||
return fmt.Errorf("can't encode stories.sendStory#8f9e6898 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field peer is nil")
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field peer: %w", err)
|
||||
}
|
||||
if s.Media == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field media is nil")
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field media is nil")
|
||||
}
|
||||
if err := s.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field media: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field media: %w", err)
|
||||
}
|
||||
if s.Flags.Has(5) {
|
||||
b.PutVectorHeader(len(s.MediaAreas))
|
||||
for idx, v := range s.MediaAreas {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field media_areas element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field media_areas element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field media_areas element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field media_areas element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,20 +436,20 @@ func (s *StoriesSendStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(s.Entities))
|
||||
for idx, v := range s.Entities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(s.PrivacyRules))
|
||||
for idx, v := range s.PrivacyRules {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field privacy_rules element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field privacy_rules element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field privacy_rules element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field privacy_rules element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutLong(s.RandomID)
|
||||
@@ -438,10 +458,10 @@ func (s *StoriesSendStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if s.Flags.Has(6) {
|
||||
if s.FwdFromID == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field fwd_from_id is nil")
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field fwd_from_id is nil")
|
||||
}
|
||||
if err := s.FwdFromID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#737fc2ec: field fwd_from_id: %w", err)
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field fwd_from_id: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(6) {
|
||||
@@ -453,16 +473,24 @@ func (s *StoriesSendStoryRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(v)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(9) {
|
||||
if s.Music == nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field music is nil")
|
||||
}
|
||||
if err := s.Music.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode stories.sendStory#8f9e6898: field music: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StoriesSendStoryRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode stories.sendStory#737fc2ec to nil")
|
||||
return fmt.Errorf("can't decode stories.sendStory#8f9e6898 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StoriesSendStoryRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -470,11 +498,11 @@ func (s *StoriesSendStoryRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode stories.sendStory#737fc2ec to nil")
|
||||
return fmt.Errorf("can't decode stories.sendStory#8f9e6898 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
s.Pinned = s.Flags.Has(2)
|
||||
@@ -483,21 +511,21 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field media: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field media: %w", err)
|
||||
}
|
||||
s.Media = value
|
||||
}
|
||||
if s.Flags.Has(5) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field media_areas: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -506,7 +534,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMediaArea(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field media_areas: %w", err)
|
||||
}
|
||||
s.MediaAreas = append(s.MediaAreas, value)
|
||||
}
|
||||
@@ -514,14 +542,14 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field caption: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field caption: %w", err)
|
||||
}
|
||||
s.Caption = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -530,7 +558,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field entities: %w", err)
|
||||
}
|
||||
s.Entities = append(s.Entities, value)
|
||||
}
|
||||
@@ -538,7 +566,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field privacy_rules: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field privacy_rules: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -547,7 +575,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeInputPrivacyRule(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field privacy_rules: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field privacy_rules: %w", err)
|
||||
}
|
||||
s.PrivacyRules = append(s.PrivacyRules, value)
|
||||
}
|
||||
@@ -555,35 +583,35 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field random_id: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field random_id: %w", err)
|
||||
}
|
||||
s.RandomID = value
|
||||
}
|
||||
if s.Flags.Has(3) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field period: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field period: %w", err)
|
||||
}
|
||||
s.Period = value
|
||||
}
|
||||
if s.Flags.Has(6) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field fwd_from_id: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field fwd_from_id: %w", err)
|
||||
}
|
||||
s.FwdFromID = value
|
||||
}
|
||||
if s.Flags.Has(6) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field fwd_from_story: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field fwd_from_story: %w", err)
|
||||
}
|
||||
s.FwdFromStory = value
|
||||
}
|
||||
if s.Flags.Has(8) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field albums: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field albums: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -592,11 +620,18 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#737fc2ec: field albums: %w", err)
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field albums: %w", err)
|
||||
}
|
||||
s.Albums = append(s.Albums, value)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(9) {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode stories.sendStory#8f9e6898: field music: %w", err)
|
||||
}
|
||||
s.Music = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -815,6 +850,24 @@ func (s *StoriesSendStoryRequest) GetAlbums() (value []int, ok bool) {
|
||||
return s.Albums, true
|
||||
}
|
||||
|
||||
// SetMusic sets value of Music conditional field.
|
||||
func (s *StoriesSendStoryRequest) SetMusic(value InputDocumentClass) {
|
||||
s.Flags.Set(9)
|
||||
s.Music = value
|
||||
}
|
||||
|
||||
// GetMusic returns value of Music conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StoriesSendStoryRequest) GetMusic() (value InputDocumentClass, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(9) {
|
||||
return value, false
|
||||
}
|
||||
return s.Music, true
|
||||
}
|
||||
|
||||
// MapMediaAreas returns field MediaAreas wrapped in MediaAreaClassArray helper.
|
||||
func (s *StoriesSendStoryRequest) MapMediaAreas() (value MediaAreaClassArray, ok bool) {
|
||||
if !s.Flags.Has(5) {
|
||||
@@ -836,7 +889,16 @@ func (s *StoriesSendStoryRequest) MapPrivacyRules() (value InputPrivacyRuleClass
|
||||
return InputPrivacyRuleClassArray(s.PrivacyRules)
|
||||
}
|
||||
|
||||
// StoriesSendStory invokes method stories.sendStory#737fc2ec returning error if any.
|
||||
// GetMusicAsNotEmpty returns mapped value of Music conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StoriesSendStoryRequest) GetMusicAsNotEmpty() (*InputDocument, bool) {
|
||||
if value, ok := s.GetMusic(); ok {
|
||||
return value.AsNotEmpty()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// StoriesSendStory invokes method stories.sendStory#8f9e6898 returning error if any.
|
||||
// Uploads a Telegram Story¹.
|
||||
// May also be used in a business connection¹, not by wrapping the query in
|
||||
// invokeWithBusinessConnection »², but rather by specifying the ID of a controlled
|
||||
|
||||
Generated
+95
-42
@@ -455,7 +455,7 @@ func (s *StoryItemSkipped) GetExpireDate() (value int) {
|
||||
return s.ExpireDate
|
||||
}
|
||||
|
||||
// StoryItem represents TL type `storyItem#edf164f1`.
|
||||
// StoryItem represents TL type `storyItem#16a4b93c`.
|
||||
// Represents a story¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -558,10 +558,14 @@ type StoryItem struct {
|
||||
//
|
||||
// Use SetAlbums and GetAlbums helpers.
|
||||
Albums []int
|
||||
// Music field of StoryItem.
|
||||
//
|
||||
// Use SetMusic and GetMusic helpers.
|
||||
Music DocumentClass
|
||||
}
|
||||
|
||||
// StoryItemTypeID is TL type id of StoryItem.
|
||||
const StoryItemTypeID = 0xedf164f1
|
||||
const StoryItemTypeID = 0x16a4b93c
|
||||
|
||||
// construct implements constructor of StoryItemClass.
|
||||
func (s StoryItem) construct() StoryItemClass { return &s }
|
||||
@@ -649,6 +653,9 @@ func (s *StoryItem) Zero() bool {
|
||||
if !(s.Albums == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Music == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -686,6 +693,7 @@ func (s *StoryItem) FillFrom(from interface {
|
||||
GetViews() (value StoryViews, ok bool)
|
||||
GetSentReaction() (value ReactionClass, ok bool)
|
||||
GetAlbums() (value []int, ok bool)
|
||||
GetMusic() (value DocumentClass, ok bool)
|
||||
}) {
|
||||
s.Pinned = from.GetPinned()
|
||||
s.Public = from.GetPublic()
|
||||
@@ -736,6 +744,10 @@ func (s *StoryItem) FillFrom(from interface {
|
||||
s.Albums = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetMusic(); ok {
|
||||
s.Music = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -867,6 +879,11 @@ func (s *StoryItem) TypeInfo() tdp.Type {
|
||||
SchemaName: "albums",
|
||||
Null: !s.Flags.Has(19),
|
||||
},
|
||||
{
|
||||
Name: "Music",
|
||||
SchemaName: "music",
|
||||
Null: !s.Flags.Has(20),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -927,12 +944,15 @@ func (s *StoryItem) SetFlags() {
|
||||
if !(s.Albums == nil) {
|
||||
s.Flags.Set(19)
|
||||
}
|
||||
if !(s.Music == nil) {
|
||||
s.Flags.Set(20)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StoryItem) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode storyItem#edf164f1 as nil")
|
||||
return fmt.Errorf("can't encode storyItem#16a4b93c as nil")
|
||||
}
|
||||
b.PutID(StoryItemTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -941,25 +961,25 @@ func (s *StoryItem) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StoryItem) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode storyItem#edf164f1 as nil")
|
||||
return fmt.Errorf("can't encode storyItem#16a4b93c as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(s.ID)
|
||||
b.PutInt(s.Date)
|
||||
if s.Flags.Has(18) {
|
||||
if s.FromID == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field from_id is nil")
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field from_id is nil")
|
||||
}
|
||||
if err := s.FromID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field from_id: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(17) {
|
||||
if err := s.FwdFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field fwd_from: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field fwd_from: %w", err)
|
||||
}
|
||||
}
|
||||
b.PutInt(s.ExpireDate)
|
||||
@@ -970,27 +990,27 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(s.Entities))
|
||||
for idx, v := range s.Entities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if s.Media == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field media is nil")
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field media is nil")
|
||||
}
|
||||
if err := s.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field media: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field media: %w", err)
|
||||
}
|
||||
if s.Flags.Has(14) {
|
||||
b.PutVectorHeader(len(s.MediaAreas))
|
||||
for idx, v := range s.MediaAreas {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field media_areas element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field media_areas element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field media_areas element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field media_areas element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -998,24 +1018,24 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(s.Privacy))
|
||||
for idx, v := range s.Privacy {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field privacy element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field privacy element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field privacy element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field privacy element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(3) {
|
||||
if err := s.Views.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field views: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field views: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(15) {
|
||||
if s.SentReaction == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field sent_reaction is nil")
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field sent_reaction is nil")
|
||||
}
|
||||
if err := s.SentReaction.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#edf164f1: field sent_reaction: %w", err)
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field sent_reaction: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(19) {
|
||||
@@ -1024,16 +1044,24 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(v)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(20) {
|
||||
if s.Music == nil {
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field music is nil")
|
||||
}
|
||||
if err := s.Music.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode storyItem#16a4b93c: field music: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StoryItem) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode storyItem#edf164f1 to nil")
|
||||
return fmt.Errorf("can't decode storyItem#16a4b93c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StoryItemTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -1041,11 +1069,11 @@ func (s *StoryItem) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode storyItem#edf164f1 to nil")
|
||||
return fmt.Errorf("can't decode storyItem#16a4b93c to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
s.Pinned = s.Flags.Has(5)
|
||||
@@ -1060,47 +1088,47 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field id: %w", err)
|
||||
}
|
||||
s.ID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field date: %w", err)
|
||||
}
|
||||
s.Date = value
|
||||
}
|
||||
if s.Flags.Has(18) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field from_id: %w", err)
|
||||
}
|
||||
s.FromID = value
|
||||
}
|
||||
if s.Flags.Has(17) {
|
||||
if err := s.FwdFrom.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field fwd_from: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field fwd_from: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field expire_date: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field expire_date: %w", err)
|
||||
}
|
||||
s.ExpireDate = value
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field caption: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field caption: %w", err)
|
||||
}
|
||||
s.Caption = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1109,7 +1137,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field entities: %w", err)
|
||||
}
|
||||
s.Entities = append(s.Entities, value)
|
||||
}
|
||||
@@ -1117,14 +1145,14 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field media: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field media: %w", err)
|
||||
}
|
||||
s.Media = value
|
||||
}
|
||||
if s.Flags.Has(14) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field media_areas: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1133,7 +1161,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMediaArea(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field media_areas: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field media_areas: %w", err)
|
||||
}
|
||||
s.MediaAreas = append(s.MediaAreas, value)
|
||||
}
|
||||
@@ -1141,7 +1169,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
if s.Flags.Has(2) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field privacy: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field privacy: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1150,27 +1178,27 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodePrivacyRule(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field privacy: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field privacy: %w", err)
|
||||
}
|
||||
s.Privacy = append(s.Privacy, value)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(3) {
|
||||
if err := s.Views.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field views: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field views: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(15) {
|
||||
value, err := DecodeReaction(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field sent_reaction: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field sent_reaction: %w", err)
|
||||
}
|
||||
s.SentReaction = value
|
||||
}
|
||||
if s.Flags.Has(19) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field albums: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field albums: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1179,11 +1207,18 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#edf164f1: field albums: %w", err)
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field albums: %w", err)
|
||||
}
|
||||
s.Albums = append(s.Albums, value)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(20) {
|
||||
value, err := DecodeDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyItem#16a4b93c: field music: %w", err)
|
||||
}
|
||||
s.Music = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1552,6 +1587,24 @@ func (s *StoryItem) GetAlbums() (value []int, ok bool) {
|
||||
return s.Albums, true
|
||||
}
|
||||
|
||||
// SetMusic sets value of Music conditional field.
|
||||
func (s *StoryItem) SetMusic(value DocumentClass) {
|
||||
s.Flags.Set(20)
|
||||
s.Music = value
|
||||
}
|
||||
|
||||
// GetMusic returns value of Music conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StoryItem) GetMusic() (value DocumentClass, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(20) {
|
||||
return value, false
|
||||
}
|
||||
return s.Music, true
|
||||
}
|
||||
|
||||
// MapEntities returns field Entities wrapped in MessageEntityClassArray helper.
|
||||
func (s *StoryItem) MapEntities() (value MessageEntityClassArray, ok bool) {
|
||||
if !s.Flags.Has(1) {
|
||||
@@ -1592,7 +1645,7 @@ const StoryItemClassName = "StoryItem"
|
||||
// switch v := g.(type) {
|
||||
// case *tg.StoryItemDeleted: // storyItemDeleted#51e6ee4f
|
||||
// case *tg.StoryItemSkipped: // storyItemSkipped#ffadc913
|
||||
// case *tg.StoryItem: // storyItem#edf164f1
|
||||
// case *tg.StoryItem: // storyItem#16a4b93c
|
||||
// default: panic(v)
|
||||
// }
|
||||
type StoryItemClass interface {
|
||||
@@ -1639,7 +1692,7 @@ func DecodeStoryItem(buf *bin.Buffer) (StoryItemClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case StoryItemTypeID:
|
||||
// Decoding storyItem#edf164f1.
|
||||
// Decoding storyItem#16a4b93c.
|
||||
v := StoryItem{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StoryItemClass: %w", err)
|
||||
|
||||
Generated
+417
-32
@@ -13021,7 +13021,7 @@ func (u *UpdateDialogUnreadMark) GetSavedPeerID() (value PeerClass, ok bool) {
|
||||
return u.SavedPeerID, true
|
||||
}
|
||||
|
||||
// UpdateMessagePoll represents TL type `updateMessagePoll#aca1657b`.
|
||||
// UpdateMessagePoll represents TL type `updateMessagePoll#d64c522b`.
|
||||
// The results of a poll have changed
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateMessagePoll for reference.
|
||||
@@ -13031,6 +13031,18 @@ type UpdateMessagePoll struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Peer field of UpdateMessagePoll.
|
||||
//
|
||||
// Use SetPeer and GetPeer helpers.
|
||||
Peer PeerClass
|
||||
// MsgID field of UpdateMessagePoll.
|
||||
//
|
||||
// Use SetMsgID and GetMsgID helpers.
|
||||
MsgID int
|
||||
// TopMsgID field of UpdateMessagePoll.
|
||||
//
|
||||
// Use SetTopMsgID and GetTopMsgID helpers.
|
||||
TopMsgID int
|
||||
// Poll ID
|
||||
PollID int64
|
||||
// If the server knows the client hasn't cached this poll yet, the poll itself
|
||||
@@ -13042,7 +13054,7 @@ type UpdateMessagePoll struct {
|
||||
}
|
||||
|
||||
// UpdateMessagePollTypeID is TL type id of UpdateMessagePoll.
|
||||
const UpdateMessagePollTypeID = 0xaca1657b
|
||||
const UpdateMessagePollTypeID = 0xd64c522b
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateMessagePoll) construct() UpdateClass { return &u }
|
||||
@@ -13064,6 +13076,15 @@ func (u *UpdateMessagePoll) Zero() bool {
|
||||
if !(u.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(u.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(u.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.TopMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.PollID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -13088,10 +13109,25 @@ func (u *UpdateMessagePoll) String() string {
|
||||
|
||||
// FillFrom fills UpdateMessagePoll from given interface.
|
||||
func (u *UpdateMessagePoll) FillFrom(from interface {
|
||||
GetPeer() (value PeerClass, ok bool)
|
||||
GetMsgID() (value int, ok bool)
|
||||
GetTopMsgID() (value int, ok bool)
|
||||
GetPollID() (value int64)
|
||||
GetPoll() (value Poll, ok bool)
|
||||
GetResults() (value PollResults)
|
||||
}) {
|
||||
if val, ok := from.GetPeer(); ok {
|
||||
u.Peer = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetMsgID(); ok {
|
||||
u.MsgID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetTopMsgID(); ok {
|
||||
u.TopMsgID = val
|
||||
}
|
||||
|
||||
u.PollID = from.GetPollID()
|
||||
if val, ok := from.GetPoll(); ok {
|
||||
u.Poll = val
|
||||
@@ -13123,6 +13159,21 @@ func (u *UpdateMessagePoll) TypeInfo() tdp.Type {
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
Null: !u.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
Null: !u.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "TopMsgID",
|
||||
SchemaName: "top_msg_id",
|
||||
Null: !u.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "PollID",
|
||||
SchemaName: "poll_id",
|
||||
@@ -13142,6 +13193,15 @@ func (u *UpdateMessagePoll) TypeInfo() tdp.Type {
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (u *UpdateMessagePoll) SetFlags() {
|
||||
if !(u.Peer == nil) {
|
||||
u.Flags.Set(1)
|
||||
}
|
||||
if !(u.MsgID == 0) {
|
||||
u.Flags.Set(1)
|
||||
}
|
||||
if !(u.TopMsgID == 0) {
|
||||
u.Flags.Set(2)
|
||||
}
|
||||
if !(u.Poll.Zero()) {
|
||||
u.Flags.Set(0)
|
||||
}
|
||||
@@ -13150,7 +13210,7 @@ func (u *UpdateMessagePoll) SetFlags() {
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateMessagePoll) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateMessagePoll#aca1657b as nil")
|
||||
return fmt.Errorf("can't encode updateMessagePoll#d64c522b as nil")
|
||||
}
|
||||
b.PutID(UpdateMessagePollTypeID)
|
||||
return u.EncodeBare(b)
|
||||
@@ -13159,20 +13219,34 @@ func (u *UpdateMessagePoll) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateMessagePoll) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateMessagePoll#aca1657b as nil")
|
||||
return fmt.Errorf("can't encode updateMessagePoll#d64c522b as nil")
|
||||
}
|
||||
u.SetFlags()
|
||||
if err := u.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#aca1657b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field flags: %w", err)
|
||||
}
|
||||
if u.Flags.Has(1) {
|
||||
if u.Peer == nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field peer is nil")
|
||||
}
|
||||
if err := u.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field peer: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(1) {
|
||||
b.PutInt(u.MsgID)
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
b.PutInt(u.TopMsgID)
|
||||
}
|
||||
b.PutLong(u.PollID)
|
||||
if u.Flags.Has(0) {
|
||||
if err := u.Poll.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#aca1657b: field poll: %w", err)
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field poll: %w", err)
|
||||
}
|
||||
}
|
||||
if err := u.Results.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#aca1657b: field results: %w", err)
|
||||
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field results: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -13180,10 +13254,10 @@ func (u *UpdateMessagePoll) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateMessagePoll) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateMessagePoll#aca1657b to nil")
|
||||
return fmt.Errorf("can't decode updateMessagePoll#d64c522b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateMessagePollTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#aca1657b: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
@@ -13191,33 +13265,108 @@ func (u *UpdateMessagePoll) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateMessagePoll) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateMessagePoll#aca1657b to nil")
|
||||
return fmt.Errorf("can't decode updateMessagePoll#d64c522b to nil")
|
||||
}
|
||||
{
|
||||
if err := u.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#aca1657b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(1) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field peer: %w", err)
|
||||
}
|
||||
u.Peer = value
|
||||
}
|
||||
if u.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field msg_id: %w", err)
|
||||
}
|
||||
u.MsgID = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field top_msg_id: %w", err)
|
||||
}
|
||||
u.TopMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#aca1657b: field poll_id: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field poll_id: %w", err)
|
||||
}
|
||||
u.PollID = value
|
||||
}
|
||||
if u.Flags.Has(0) {
|
||||
if err := u.Poll.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#aca1657b: field poll: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field poll: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := u.Results.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#aca1657b: field results: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field results: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPeer sets value of Peer conditional field.
|
||||
func (u *UpdateMessagePoll) SetPeer(value PeerClass) {
|
||||
u.Flags.Set(1)
|
||||
u.Peer = value
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *UpdateMessagePoll) GetPeer() (value PeerClass, ok bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
if !u.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return u.Peer, true
|
||||
}
|
||||
|
||||
// SetMsgID sets value of MsgID conditional field.
|
||||
func (u *UpdateMessagePoll) SetMsgID(value int) {
|
||||
u.Flags.Set(1)
|
||||
u.MsgID = value
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *UpdateMessagePoll) GetMsgID() (value int, ok bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
if !u.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return u.MsgID, true
|
||||
}
|
||||
|
||||
// SetTopMsgID sets value of TopMsgID conditional field.
|
||||
func (u *UpdateMessagePoll) SetTopMsgID(value int) {
|
||||
u.Flags.Set(2)
|
||||
u.TopMsgID = value
|
||||
}
|
||||
|
||||
// GetTopMsgID returns value of TopMsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *UpdateMessagePoll) GetTopMsgID() (value int, ok bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
if !u.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return u.TopMsgID, true
|
||||
}
|
||||
|
||||
// GetPollID returns value of PollID field.
|
||||
func (u *UpdateMessagePoll) GetPollID() (value int64) {
|
||||
if u == nil {
|
||||
@@ -14806,7 +14955,7 @@ func (u *UpdateLoginToken) DecodeBare(b *bin.Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateMessagePollVote represents TL type `updateMessagePollVote#24f40e77`.
|
||||
// UpdateMessagePollVote represents TL type `updateMessagePollVote#7699f014`.
|
||||
// A specific peer has voted in a poll
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateMessagePollVote for reference.
|
||||
@@ -14817,6 +14966,8 @@ type UpdateMessagePollVote struct {
|
||||
Peer PeerClass
|
||||
// Chosen option(s)
|
||||
Options [][]byte
|
||||
// Positions field of UpdateMessagePollVote.
|
||||
Positions []int
|
||||
// New qts value, see updates »¹ for more info.
|
||||
//
|
||||
// Links:
|
||||
@@ -14825,7 +14976,7 @@ type UpdateMessagePollVote struct {
|
||||
}
|
||||
|
||||
// UpdateMessagePollVoteTypeID is TL type id of UpdateMessagePollVote.
|
||||
const UpdateMessagePollVoteTypeID = 0x24f40e77
|
||||
const UpdateMessagePollVoteTypeID = 0x7699f014
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateMessagePollVote) construct() UpdateClass { return &u }
|
||||
@@ -14853,6 +15004,9 @@ func (u *UpdateMessagePollVote) Zero() bool {
|
||||
if !(u.Options == nil) {
|
||||
return false
|
||||
}
|
||||
if !(u.Positions == nil) {
|
||||
return false
|
||||
}
|
||||
if !(u.Qts == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -14874,11 +15028,13 @@ func (u *UpdateMessagePollVote) FillFrom(from interface {
|
||||
GetPollID() (value int64)
|
||||
GetPeer() (value PeerClass)
|
||||
GetOptions() (value [][]byte)
|
||||
GetPositions() (value []int)
|
||||
GetQts() (value int)
|
||||
}) {
|
||||
u.PollID = from.GetPollID()
|
||||
u.Peer = from.GetPeer()
|
||||
u.Options = from.GetOptions()
|
||||
u.Positions = from.GetPositions()
|
||||
u.Qts = from.GetQts()
|
||||
}
|
||||
|
||||
@@ -14917,6 +15073,10 @@ func (u *UpdateMessagePollVote) TypeInfo() tdp.Type {
|
||||
Name: "Options",
|
||||
SchemaName: "options",
|
||||
},
|
||||
{
|
||||
Name: "Positions",
|
||||
SchemaName: "positions",
|
||||
},
|
||||
{
|
||||
Name: "Qts",
|
||||
SchemaName: "qts",
|
||||
@@ -14928,7 +15088,7 @@ func (u *UpdateMessagePollVote) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateMessagePollVote) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateMessagePollVote#24f40e77 as nil")
|
||||
return fmt.Errorf("can't encode updateMessagePollVote#7699f014 as nil")
|
||||
}
|
||||
b.PutID(UpdateMessagePollVoteTypeID)
|
||||
return u.EncodeBare(b)
|
||||
@@ -14937,19 +15097,23 @@ func (u *UpdateMessagePollVote) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateMessagePollVote) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateMessagePollVote#24f40e77 as nil")
|
||||
return fmt.Errorf("can't encode updateMessagePollVote#7699f014 as nil")
|
||||
}
|
||||
b.PutLong(u.PollID)
|
||||
if u.Peer == nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePollVote#24f40e77: field peer is nil")
|
||||
return fmt.Errorf("unable to encode updateMessagePollVote#7699f014: field peer is nil")
|
||||
}
|
||||
if err := u.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateMessagePollVote#24f40e77: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode updateMessagePollVote#7699f014: field peer: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(u.Options))
|
||||
for _, v := range u.Options {
|
||||
b.PutBytes(v)
|
||||
}
|
||||
b.PutVectorHeader(len(u.Positions))
|
||||
for _, v := range u.Positions {
|
||||
b.PutInt(v)
|
||||
}
|
||||
b.PutInt(u.Qts)
|
||||
return nil
|
||||
}
|
||||
@@ -14957,10 +15121,10 @@ func (u *UpdateMessagePollVote) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateMessagePollVote) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateMessagePollVote#24f40e77 to nil")
|
||||
return fmt.Errorf("can't decode updateMessagePollVote#7699f014 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateMessagePollVoteTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
@@ -14968,26 +15132,26 @@ func (u *UpdateMessagePollVote) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateMessagePollVote) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateMessagePollVote#24f40e77 to nil")
|
||||
return fmt.Errorf("can't decode updateMessagePollVote#7699f014 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: field poll_id: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field poll_id: %w", err)
|
||||
}
|
||||
u.PollID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field peer: %w", err)
|
||||
}
|
||||
u.Peer = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: field options: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field options: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -14996,15 +15160,32 @@ func (u *UpdateMessagePollVote) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: field options: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field options: %w", err)
|
||||
}
|
||||
u.Options = append(u.Options, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field positions: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
u.Positions = make([]int, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field positions: %w", err)
|
||||
}
|
||||
u.Positions = append(u.Positions, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#24f40e77: field qts: %w", err)
|
||||
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field qts: %w", err)
|
||||
}
|
||||
u.Qts = value
|
||||
}
|
||||
@@ -15035,6 +15216,14 @@ func (u *UpdateMessagePollVote) GetOptions() (value [][]byte) {
|
||||
return u.Options
|
||||
}
|
||||
|
||||
// GetPositions returns value of Positions field.
|
||||
func (u *UpdateMessagePollVote) GetPositions() (value []int) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Positions
|
||||
}
|
||||
|
||||
// GetQts returns value of Qts field.
|
||||
func (u *UpdateMessagePollVote) GetQts() (value int) {
|
||||
if u == nil {
|
||||
@@ -31162,6 +31351,194 @@ func (u *UpdateChatParticipantRank) GetVersion() (value int) {
|
||||
return u.Version
|
||||
}
|
||||
|
||||
// UpdateManagedBot represents TL type `updateManagedBot#4880ed9a`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateManagedBot for reference.
|
||||
type UpdateManagedBot struct {
|
||||
// UserID field of UpdateManagedBot.
|
||||
UserID int64
|
||||
// BotID field of UpdateManagedBot.
|
||||
BotID int64
|
||||
// Qts field of UpdateManagedBot.
|
||||
Qts int
|
||||
}
|
||||
|
||||
// UpdateManagedBotTypeID is TL type id of UpdateManagedBot.
|
||||
const UpdateManagedBotTypeID = 0x4880ed9a
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateManagedBot) construct() UpdateClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpdateManagedBot.
|
||||
var (
|
||||
_ bin.Encoder = &UpdateManagedBot{}
|
||||
_ bin.Decoder = &UpdateManagedBot{}
|
||||
_ bin.BareEncoder = &UpdateManagedBot{}
|
||||
_ bin.BareDecoder = &UpdateManagedBot{}
|
||||
|
||||
_ UpdateClass = &UpdateManagedBot{}
|
||||
)
|
||||
|
||||
func (u *UpdateManagedBot) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.BotID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.Qts == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpdateManagedBot) String() string {
|
||||
if u == nil {
|
||||
return "UpdateManagedBot(nil)"
|
||||
}
|
||||
type Alias UpdateManagedBot
|
||||
return fmt.Sprintf("UpdateManagedBot%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// FillFrom fills UpdateManagedBot from given interface.
|
||||
func (u *UpdateManagedBot) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetBotID() (value int64)
|
||||
GetQts() (value int)
|
||||
}) {
|
||||
u.UserID = from.GetUserID()
|
||||
u.BotID = from.GetBotID()
|
||||
u.Qts = from.GetQts()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpdateManagedBot) TypeID() uint32 {
|
||||
return UpdateManagedBotTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpdateManagedBot) TypeName() string {
|
||||
return "updateManagedBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpdateManagedBot) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "updateManagedBot",
|
||||
ID: UpdateManagedBotTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "BotID",
|
||||
SchemaName: "bot_id",
|
||||
},
|
||||
{
|
||||
Name: "Qts",
|
||||
SchemaName: "qts",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateManagedBot) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateManagedBot#4880ed9a as nil")
|
||||
}
|
||||
b.PutID(UpdateManagedBotTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateManagedBot) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateManagedBot#4880ed9a as nil")
|
||||
}
|
||||
b.PutLong(u.UserID)
|
||||
b.PutLong(u.BotID)
|
||||
b.PutInt(u.Qts)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateManagedBot) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateManagedBot#4880ed9a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateManagedBotTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateManagedBot) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateManagedBot#4880ed9a to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field user_id: %w", err)
|
||||
}
|
||||
u.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field bot_id: %w", err)
|
||||
}
|
||||
u.BotID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field qts: %w", err)
|
||||
}
|
||||
u.Qts = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (u *UpdateManagedBot) GetUserID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.UserID
|
||||
}
|
||||
|
||||
// GetBotID returns value of BotID field.
|
||||
func (u *UpdateManagedBot) GetBotID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.BotID
|
||||
}
|
||||
|
||||
// GetQts returns value of Qts field.
|
||||
func (u *UpdateManagedBot) GetQts() (value int) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Qts
|
||||
}
|
||||
|
||||
// UpdateClassName is schema name of UpdateClass.
|
||||
const UpdateClassName = "Update"
|
||||
|
||||
@@ -31238,7 +31615,7 @@ const UpdateClassName = "Update"
|
||||
// case *tg.UpdateContactsReset: // updateContactsReset#7084a7be
|
||||
// case *tg.UpdateChannelAvailableMessages: // updateChannelAvailableMessages#b23fc698
|
||||
// case *tg.UpdateDialogUnreadMark: // updateDialogUnreadMark#b658f23e
|
||||
// case *tg.UpdateMessagePoll: // updateMessagePoll#aca1657b
|
||||
// case *tg.UpdateMessagePoll: // updateMessagePoll#d64c522b
|
||||
// case *tg.UpdateChatDefaultBannedRights: // updateChatDefaultBannedRights#54c01850
|
||||
// case *tg.UpdateFolderPeers: // updateFolderPeers#19360dc0
|
||||
// case *tg.UpdatePeerSettings: // updatePeerSettings#6a7e7366
|
||||
@@ -31248,7 +31625,7 @@ const UpdateClassName = "Update"
|
||||
// case *tg.UpdateTheme: // updateTheme#8216fba3
|
||||
// case *tg.UpdateGeoLiveViewed: // updateGeoLiveViewed#871fb939
|
||||
// case *tg.UpdateLoginToken: // updateLoginToken#564fe691
|
||||
// case *tg.UpdateMessagePollVote: // updateMessagePollVote#24f40e77
|
||||
// case *tg.UpdateMessagePollVote: // updateMessagePollVote#7699f014
|
||||
// case *tg.UpdateDialogFilter: // updateDialogFilter#26ffde7d
|
||||
// case *tg.UpdateDialogFilterOrder: // updateDialogFilterOrder#a5d72105
|
||||
// case *tg.UpdateDialogFilters: // updateDialogFilters#3504914f
|
||||
@@ -31329,6 +31706,7 @@ const UpdateClassName = "Update"
|
||||
// case *tg.UpdateEmojiGameInfo: // updateEmojiGameInfo#fb9c547a
|
||||
// case *tg.UpdateStarGiftCraftFail: // updateStarGiftCraftFail#ac072444
|
||||
// case *tg.UpdateChatParticipantRank: // updateChatParticipantRank#bd8367b9
|
||||
// case *tg.UpdateManagedBot: // updateManagedBot#4880ed9a
|
||||
// default: panic(v)
|
||||
// }
|
||||
type UpdateClass interface {
|
||||
@@ -31792,7 +32170,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateMessagePollTypeID:
|
||||
// Decoding updateMessagePoll#aca1657b.
|
||||
// Decoding updateMessagePoll#d64c522b.
|
||||
v := UpdateMessagePoll{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
@@ -31862,7 +32240,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateMessagePollVoteTypeID:
|
||||
// Decoding updateMessagePollVote#24f40e77.
|
||||
// Decoding updateMessagePollVote#7699f014.
|
||||
v := UpdateMessagePollVote{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
@@ -32428,6 +32806,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateManagedBotTypeID:
|
||||
// Decoding updateManagedBot#4880ed9a.
|
||||
v := UpdateManagedBot{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
Generated
+95
@@ -1884,6 +1884,19 @@ func (s UpdateClassArray) AsUpdateChatParticipantRank() (to UpdateChatParticipan
|
||||
return to
|
||||
}
|
||||
|
||||
// AsUpdateManagedBot returns copy with only UpdateManagedBot constructors.
|
||||
func (s UpdateClassArray) AsUpdateManagedBot() (to UpdateManagedBotArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*UpdateManagedBot)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// UpdateNewMessageArray is adapter for slice of UpdateNewMessage.
|
||||
type UpdateNewMessageArray []UpdateNewMessage
|
||||
|
||||
@@ -13301,3 +13314,85 @@ func (s *UpdateChatParticipantRankArray) Pop() (v UpdateChatParticipantRank, ok
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// UpdateManagedBotArray is adapter for slice of UpdateManagedBot.
|
||||
type UpdateManagedBotArray []UpdateManagedBot
|
||||
|
||||
// Sort sorts slice of UpdateManagedBot.
|
||||
func (s UpdateManagedBotArray) Sort(less func(a, b UpdateManagedBot) bool) UpdateManagedBotArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of UpdateManagedBot.
|
||||
func (s UpdateManagedBotArray) SortStable(less func(a, b UpdateManagedBot) bool) UpdateManagedBotArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of UpdateManagedBot.
|
||||
func (s UpdateManagedBotArray) Retain(keep func(x UpdateManagedBot) bool) UpdateManagedBotArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s UpdateManagedBotArray) First() (v UpdateManagedBot, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s UpdateManagedBotArray) Last() (v UpdateManagedBot, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *UpdateManagedBotArray) PopFirst() (v UpdateManagedBot, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero UpdateManagedBot
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *UpdateManagedBotArray) Pop() (v UpdateManagedBot, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
Generated
+2
@@ -86,6 +86,8 @@ func IsQtsUpdate(u UpdateClass) (qts int, ok bool) {
|
||||
return u.Qts, true
|
||||
case *UpdateBotPurchasedPaidMedia:
|
||||
return u.Qts, true
|
||||
case *UpdateManagedBot:
|
||||
return u.Qts, true
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
Generated
+105
-22
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// URLAuthResultRequest represents TL type `urlAuthResultRequest#f8f8eb1e`.
|
||||
// URLAuthResultRequest represents TL type `urlAuthResultRequest#3cd623ec`.
|
||||
// Details about the authorization request, for more info click here »¹
|
||||
//
|
||||
// Links:
|
||||
@@ -50,6 +50,8 @@ type URLAuthResultRequest struct {
|
||||
RequestPhoneNumber bool
|
||||
// MatchCodesFirst field of URLAuthResultRequest.
|
||||
MatchCodesFirst bool
|
||||
// IsApp field of URLAuthResultRequest.
|
||||
IsApp bool
|
||||
// Username of a bot, which will be used for user authorization. If not specified, the
|
||||
// current bot's username will be assumed. The url's domain must be the same as the
|
||||
// domain linked with the bot. See Linking your domain to the bot¹ for more details.
|
||||
@@ -83,10 +85,14 @@ type URLAuthResultRequest struct {
|
||||
//
|
||||
// Use SetUserIDHint and GetUserIDHint helpers.
|
||||
UserIDHint int64
|
||||
// VerifiedAppName field of URLAuthResultRequest.
|
||||
//
|
||||
// Use SetVerifiedAppName and GetVerifiedAppName helpers.
|
||||
VerifiedAppName string
|
||||
}
|
||||
|
||||
// URLAuthResultRequestTypeID is TL type id of URLAuthResultRequest.
|
||||
const URLAuthResultRequestTypeID = 0xf8f8eb1e
|
||||
const URLAuthResultRequestTypeID = 0x3cd623ec
|
||||
|
||||
// construct implements constructor of URLAuthResultClass.
|
||||
func (u URLAuthResultRequest) construct() URLAuthResultClass { return &u }
|
||||
@@ -117,6 +123,9 @@ func (u *URLAuthResultRequest) Zero() bool {
|
||||
if !(u.MatchCodesFirst == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.IsApp == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.Bot == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -141,6 +150,9 @@ func (u *URLAuthResultRequest) Zero() bool {
|
||||
if !(u.UserIDHint == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.VerifiedAppName == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -159,6 +171,7 @@ func (u *URLAuthResultRequest) FillFrom(from interface {
|
||||
GetRequestWriteAccess() (value bool)
|
||||
GetRequestPhoneNumber() (value bool)
|
||||
GetMatchCodesFirst() (value bool)
|
||||
GetIsApp() (value bool)
|
||||
GetBot() (value UserClass)
|
||||
GetDomain() (value string)
|
||||
GetBrowser() (value string, ok bool)
|
||||
@@ -167,10 +180,12 @@ func (u *URLAuthResultRequest) FillFrom(from interface {
|
||||
GetRegion() (value string, ok bool)
|
||||
GetMatchCodes() (value []string, ok bool)
|
||||
GetUserIDHint() (value int64, ok bool)
|
||||
GetVerifiedAppName() (value string, ok bool)
|
||||
}) {
|
||||
u.RequestWriteAccess = from.GetRequestWriteAccess()
|
||||
u.RequestPhoneNumber = from.GetRequestPhoneNumber()
|
||||
u.MatchCodesFirst = from.GetMatchCodesFirst()
|
||||
u.IsApp = from.GetIsApp()
|
||||
u.Bot = from.GetBot()
|
||||
u.Domain = from.GetDomain()
|
||||
if val, ok := from.GetBrowser(); ok {
|
||||
@@ -197,6 +212,10 @@ func (u *URLAuthResultRequest) FillFrom(from interface {
|
||||
u.UserIDHint = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetVerifiedAppName(); ok {
|
||||
u.VerifiedAppName = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -237,6 +256,11 @@ func (u *URLAuthResultRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "match_codes_first",
|
||||
Null: !u.Flags.Has(5),
|
||||
},
|
||||
{
|
||||
Name: "IsApp",
|
||||
SchemaName: "is_app",
|
||||
Null: !u.Flags.Has(6),
|
||||
},
|
||||
{
|
||||
Name: "Bot",
|
||||
SchemaName: "bot",
|
||||
@@ -275,6 +299,11 @@ func (u *URLAuthResultRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "user_id_hint",
|
||||
Null: !u.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "VerifiedAppName",
|
||||
SchemaName: "verified_app_name",
|
||||
Null: !u.Flags.Has(7),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -290,6 +319,9 @@ func (u *URLAuthResultRequest) SetFlags() {
|
||||
if !(u.MatchCodesFirst == false) {
|
||||
u.Flags.Set(5)
|
||||
}
|
||||
if !(u.IsApp == false) {
|
||||
u.Flags.Set(6)
|
||||
}
|
||||
if !(u.Browser == "") {
|
||||
u.Flags.Set(2)
|
||||
}
|
||||
@@ -308,12 +340,15 @@ func (u *URLAuthResultRequest) SetFlags() {
|
||||
if !(u.UserIDHint == 0) {
|
||||
u.Flags.Set(4)
|
||||
}
|
||||
if !(u.VerifiedAppName == "") {
|
||||
u.Flags.Set(7)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *URLAuthResultRequest) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode urlAuthResultRequest#f8f8eb1e as nil")
|
||||
return fmt.Errorf("can't encode urlAuthResultRequest#3cd623ec as nil")
|
||||
}
|
||||
b.PutID(URLAuthResultRequestTypeID)
|
||||
return u.EncodeBare(b)
|
||||
@@ -322,17 +357,17 @@ func (u *URLAuthResultRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *URLAuthResultRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode urlAuthResultRequest#f8f8eb1e as nil")
|
||||
return fmt.Errorf("can't encode urlAuthResultRequest#3cd623ec as nil")
|
||||
}
|
||||
u.SetFlags()
|
||||
if err := u.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field flags: %w", err)
|
||||
}
|
||||
if u.Bot == nil {
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field bot is nil")
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field bot is nil")
|
||||
}
|
||||
if err := u.Bot.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field bot: %w", err)
|
||||
return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field bot: %w", err)
|
||||
}
|
||||
b.PutString(u.Domain)
|
||||
if u.Flags.Has(2) {
|
||||
@@ -356,16 +391,19 @@ func (u *URLAuthResultRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if u.Flags.Has(4) {
|
||||
b.PutLong(u.UserIDHint)
|
||||
}
|
||||
if u.Flags.Has(7) {
|
||||
b.PutString(u.VerifiedAppName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *URLAuthResultRequest) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode urlAuthResultRequest#f8f8eb1e to nil")
|
||||
return fmt.Errorf("can't decode urlAuthResultRequest#3cd623ec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(URLAuthResultRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
@@ -373,62 +411,63 @@ func (u *URLAuthResultRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *URLAuthResultRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode urlAuthResultRequest#f8f8eb1e to nil")
|
||||
return fmt.Errorf("can't decode urlAuthResultRequest#3cd623ec to nil")
|
||||
}
|
||||
{
|
||||
if err := u.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
u.RequestWriteAccess = u.Flags.Has(0)
|
||||
u.RequestPhoneNumber = u.Flags.Has(1)
|
||||
u.MatchCodesFirst = u.Flags.Has(5)
|
||||
u.IsApp = u.Flags.Has(6)
|
||||
{
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field bot: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field bot: %w", err)
|
||||
}
|
||||
u.Bot = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field domain: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field domain: %w", err)
|
||||
}
|
||||
u.Domain = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field browser: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field browser: %w", err)
|
||||
}
|
||||
u.Browser = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field platform: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field platform: %w", err)
|
||||
}
|
||||
u.Platform = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field ip: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field ip: %w", err)
|
||||
}
|
||||
u.IP = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field region: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field region: %w", err)
|
||||
}
|
||||
u.Region = value
|
||||
}
|
||||
if u.Flags.Has(3) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field match_codes: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field match_codes: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -437,7 +476,7 @@ func (u *URLAuthResultRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field match_codes: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field match_codes: %w", err)
|
||||
}
|
||||
u.MatchCodes = append(u.MatchCodes, value)
|
||||
}
|
||||
@@ -445,10 +484,17 @@ func (u *URLAuthResultRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if u.Flags.Has(4) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field user_id_hint: %w", err)
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field user_id_hint: %w", err)
|
||||
}
|
||||
u.UserIDHint = value
|
||||
}
|
||||
if u.Flags.Has(7) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field verified_app_name: %w", err)
|
||||
}
|
||||
u.VerifiedAppName = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -509,6 +555,25 @@ func (u *URLAuthResultRequest) GetMatchCodesFirst() (value bool) {
|
||||
return u.Flags.Has(5)
|
||||
}
|
||||
|
||||
// SetIsApp sets value of IsApp conditional field.
|
||||
func (u *URLAuthResultRequest) SetIsApp(value bool) {
|
||||
if value {
|
||||
u.Flags.Set(6)
|
||||
u.IsApp = true
|
||||
} else {
|
||||
u.Flags.Unset(6)
|
||||
u.IsApp = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetIsApp returns value of IsApp conditional field.
|
||||
func (u *URLAuthResultRequest) GetIsApp() (value bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Flags.Has(6)
|
||||
}
|
||||
|
||||
// GetBot returns value of Bot field.
|
||||
func (u *URLAuthResultRequest) GetBot() (value UserClass) {
|
||||
if u == nil {
|
||||
@@ -633,6 +698,24 @@ func (u *URLAuthResultRequest) GetUserIDHint() (value int64, ok bool) {
|
||||
return u.UserIDHint, true
|
||||
}
|
||||
|
||||
// SetVerifiedAppName sets value of VerifiedAppName conditional field.
|
||||
func (u *URLAuthResultRequest) SetVerifiedAppName(value string) {
|
||||
u.Flags.Set(7)
|
||||
u.VerifiedAppName = value
|
||||
}
|
||||
|
||||
// GetVerifiedAppName returns value of VerifiedAppName conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *URLAuthResultRequest) GetVerifiedAppName() (value string, ok bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
if !u.Flags.Has(7) {
|
||||
return value, false
|
||||
}
|
||||
return u.VerifiedAppName, true
|
||||
}
|
||||
|
||||
// URLAuthResultAccepted represents TL type `urlAuthResultAccepted#623a8fa0`.
|
||||
// Details about an accepted authorization request, for more info click here »¹
|
||||
//
|
||||
@@ -929,7 +1012,7 @@ const URLAuthResultClassName = "UrlAuthResult"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.URLAuthResultRequest: // urlAuthResultRequest#f8f8eb1e
|
||||
// case *tg.URLAuthResultRequest: // urlAuthResultRequest#3cd623ec
|
||||
// case *tg.URLAuthResultAccepted: // urlAuthResultAccepted#623a8fa0
|
||||
// case *tg.URLAuthResultDefault: // urlAuthResultDefault#a9d6db1f
|
||||
// default: panic(v)
|
||||
@@ -961,7 +1044,7 @@ func DecodeURLAuthResult(buf *bin.Buffer) (URLAuthResultClass, error) {
|
||||
}
|
||||
switch id {
|
||||
case URLAuthResultRequestTypeID:
|
||||
// Decoding urlAuthResultRequest#f8f8eb1e.
|
||||
// Decoding urlAuthResultRequest#3cd623ec.
|
||||
v := URLAuthResultRequest{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", err)
|
||||
|
||||
Generated
+163
-80
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// UserFull represents TL type `userFull#a02bc13e`.
|
||||
// UserFull represents TL type `userFull#6cbe645`.
|
||||
// Extended user info
|
||||
// When updating the local peer database »¹, all fields from the newly received
|
||||
// constructor take priority over the old constructor cached locally (including by
|
||||
@@ -144,6 +144,8 @@ type UserFull struct {
|
||||
NoforwardsMyEnabled bool
|
||||
// NoforwardsPeerEnabled field of UserFull.
|
||||
NoforwardsPeerEnabled bool
|
||||
// UnofficialSecurityRisk field of UserFull.
|
||||
UnofficialSecurityRisk bool
|
||||
// User ID
|
||||
ID int64
|
||||
// Bio of the user
|
||||
@@ -372,10 +374,14 @@ type UserFull struct {
|
||||
//
|
||||
// Use SetNote and GetNote helpers.
|
||||
Note TextWithEntities
|
||||
// BotManagerID field of UserFull.
|
||||
//
|
||||
// Use SetBotManagerID and GetBotManagerID helpers.
|
||||
BotManagerID int64
|
||||
}
|
||||
|
||||
// UserFullTypeID is TL type id of UserFull.
|
||||
const UserFullTypeID = 0xa02bc13e
|
||||
const UserFullTypeID = 0x6cbe645
|
||||
|
||||
// Ensuring interfaces in compile-time for UserFull.
|
||||
var (
|
||||
@@ -452,6 +458,9 @@ func (u *UserFull) Zero() bool {
|
||||
if !(u.NoforwardsPeerEnabled == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.UnofficialSecurityRisk == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.ID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -563,6 +572,9 @@ func (u *UserFull) Zero() bool {
|
||||
if !(u.Note.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(u.BotManagerID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -597,6 +609,7 @@ func (u *UserFull) FillFrom(from interface {
|
||||
GetDisplayGiftsButton() (value bool)
|
||||
GetNoforwardsMyEnabled() (value bool)
|
||||
GetNoforwardsPeerEnabled() (value bool)
|
||||
GetUnofficialSecurityRisk() (value bool)
|
||||
GetID() (value int64)
|
||||
GetAbout() (value string, ok bool)
|
||||
GetSettings() (value PeerSettings)
|
||||
@@ -634,6 +647,7 @@ func (u *UserFull) FillFrom(from interface {
|
||||
GetMainTab() (value ProfileTabClass, ok bool)
|
||||
GetSavedMusic() (value DocumentClass, ok bool)
|
||||
GetNote() (value TextWithEntities, ok bool)
|
||||
GetBotManagerID() (value int64, ok bool)
|
||||
}) {
|
||||
u.Blocked = from.GetBlocked()
|
||||
u.PhoneCallsAvailable = from.GetPhoneCallsAvailable()
|
||||
@@ -654,6 +668,7 @@ func (u *UserFull) FillFrom(from interface {
|
||||
u.DisplayGiftsButton = from.GetDisplayGiftsButton()
|
||||
u.NoforwardsMyEnabled = from.GetNoforwardsMyEnabled()
|
||||
u.NoforwardsPeerEnabled = from.GetNoforwardsPeerEnabled()
|
||||
u.UnofficialSecurityRisk = from.GetUnofficialSecurityRisk()
|
||||
u.ID = from.GetID()
|
||||
if val, ok := from.GetAbout(); ok {
|
||||
u.About = val
|
||||
@@ -790,6 +805,10 @@ func (u *UserFull) FillFrom(from interface {
|
||||
u.Note = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetBotManagerID(); ok {
|
||||
u.BotManagerID = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -910,6 +929,11 @@ func (u *UserFull) TypeInfo() tdp.Type {
|
||||
SchemaName: "noforwards_peer_enabled",
|
||||
Null: !u.Flags2.Has(24),
|
||||
},
|
||||
{
|
||||
Name: "UnofficialSecurityRisk",
|
||||
SchemaName: "unofficial_security_risk",
|
||||
Null: !u.Flags2.Has(26),
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
@@ -1091,6 +1115,11 @@ func (u *UserFull) TypeInfo() tdp.Type {
|
||||
SchemaName: "note",
|
||||
Null: !u.Flags2.Has(22),
|
||||
},
|
||||
{
|
||||
Name: "BotManagerID",
|
||||
SchemaName: "bot_manager_id",
|
||||
Null: !u.Flags2.Has(25),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -1154,6 +1183,9 @@ func (u *UserFull) SetFlags() {
|
||||
if !(u.NoforwardsPeerEnabled == false) {
|
||||
u.Flags2.Set(24)
|
||||
}
|
||||
if !(u.UnofficialSecurityRisk == false) {
|
||||
u.Flags2.Set(26)
|
||||
}
|
||||
if !(u.About == "") {
|
||||
u.Flags.Set(1)
|
||||
}
|
||||
@@ -1253,12 +1285,15 @@ func (u *UserFull) SetFlags() {
|
||||
if !(u.Note.Zero()) {
|
||||
u.Flags2.Set(22)
|
||||
}
|
||||
if !(u.BotManagerID == 0) {
|
||||
u.Flags2.Set(25)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UserFull) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode userFull#a02bc13e as nil")
|
||||
return fmt.Errorf("can't encode userFull#6cbe645 as nil")
|
||||
}
|
||||
b.PutID(UserFullTypeID)
|
||||
return u.EncodeBare(b)
|
||||
@@ -1267,52 +1302,52 @@ func (u *UserFull) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode userFull#a02bc13e as nil")
|
||||
return fmt.Errorf("can't encode userFull#6cbe645 as nil")
|
||||
}
|
||||
u.SetFlags()
|
||||
if err := u.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field flags: %w", err)
|
||||
}
|
||||
if err := u.Flags2.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field flags2: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field flags2: %w", err)
|
||||
}
|
||||
b.PutLong(u.ID)
|
||||
if u.Flags.Has(1) {
|
||||
b.PutString(u.About)
|
||||
}
|
||||
if err := u.Settings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field settings: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field settings: %w", err)
|
||||
}
|
||||
if u.Flags.Has(21) {
|
||||
if u.PersonalPhoto == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field personal_photo is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field personal_photo is nil")
|
||||
}
|
||||
if err := u.PersonalPhoto.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field personal_photo: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field personal_photo: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
if u.ProfilePhoto == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field profile_photo is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field profile_photo is nil")
|
||||
}
|
||||
if err := u.ProfilePhoto.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field profile_photo: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field profile_photo: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(22) {
|
||||
if u.FallbackPhoto == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field fallback_photo is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field fallback_photo is nil")
|
||||
}
|
||||
if err := u.FallbackPhoto.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field fallback_photo: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field fallback_photo: %w", err)
|
||||
}
|
||||
}
|
||||
if err := u.NotifySettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field notify_settings: %w", err)
|
||||
}
|
||||
if u.Flags.Has(3) {
|
||||
if err := u.BotInfo.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field bot_info: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field bot_info: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(6) {
|
||||
@@ -1327,10 +1362,10 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if u.Flags.Has(15) {
|
||||
if u.Theme == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field theme is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field theme is nil")
|
||||
}
|
||||
if err := u.Theme.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field theme: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field theme: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(16) {
|
||||
@@ -1338,55 +1373,55 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if u.Flags.Has(17) {
|
||||
if err := u.BotGroupAdminRights.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field bot_group_admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field bot_group_admin_rights: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(18) {
|
||||
if err := u.BotBroadcastAdminRights.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field bot_broadcast_admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field bot_broadcast_admin_rights: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(24) {
|
||||
if u.Wallpaper == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field wallpaper is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field wallpaper is nil")
|
||||
}
|
||||
if err := u.Wallpaper.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field wallpaper: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field wallpaper: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(25) {
|
||||
if err := u.Stories.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field stories: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field stories: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(0) {
|
||||
if err := u.BusinessWorkHours.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field business_work_hours: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field business_work_hours: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(1) {
|
||||
if err := u.BusinessLocation.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field business_location: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field business_location: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(2) {
|
||||
if err := u.BusinessGreetingMessage.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field business_greeting_message: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field business_greeting_message: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(3) {
|
||||
if err := u.BusinessAwayMessage.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field business_away_message: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field business_away_message: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(4) {
|
||||
if err := u.BusinessIntro.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field business_intro: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field business_intro: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(5) {
|
||||
if err := u.Birthday.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field birthday: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field birthday: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(6) {
|
||||
@@ -1400,12 +1435,12 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if u.Flags2.Has(11) {
|
||||
if err := u.StarrefProgram.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field starref_program: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field starref_program: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(12) {
|
||||
if err := u.BotVerification.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field bot_verification: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field bot_verification: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(14) {
|
||||
@@ -1413,17 +1448,17 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if u.Flags2.Has(15) {
|
||||
if err := u.DisallowedGifts.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field disallowed_gifts: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field disallowed_gifts: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(17) {
|
||||
if err := u.StarsRating.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field stars_rating: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field stars_rating: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(18) {
|
||||
if err := u.StarsMyPendingRating.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field stars_my_pending_rating: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field stars_my_pending_rating: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(18) {
|
||||
@@ -1431,35 +1466,38 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if u.Flags2.Has(20) {
|
||||
if u.MainTab == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field main_tab is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field main_tab is nil")
|
||||
}
|
||||
if err := u.MainTab.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field main_tab: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field main_tab: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(21) {
|
||||
if u.SavedMusic == nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field saved_music is nil")
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field saved_music is nil")
|
||||
}
|
||||
if err := u.SavedMusic.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field saved_music: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field saved_music: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(22) {
|
||||
if err := u.Note.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode userFull#a02bc13e: field note: %w", err)
|
||||
return fmt.Errorf("unable to encode userFull#6cbe645: field note: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(25) {
|
||||
b.PutLong(u.BotManagerID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UserFull) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode userFull#a02bc13e to nil")
|
||||
return fmt.Errorf("can't decode userFull#6cbe645 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UserFullTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
@@ -1467,11 +1505,11 @@ func (u *UserFull) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UserFull) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode userFull#a02bc13e to nil")
|
||||
return fmt.Errorf("can't decode userFull#6cbe645 to nil")
|
||||
}
|
||||
{
|
||||
if err := u.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
u.Blocked = u.Flags.Has(0)
|
||||
@@ -1489,7 +1527,7 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error {
|
||||
u.ReadDatesPrivate = u.Flags.Has(30)
|
||||
{
|
||||
if err := u.Flags2.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field flags2: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field flags2: %w", err)
|
||||
}
|
||||
}
|
||||
u.SponsoredEnabled = u.Flags2.Has(7)
|
||||
@@ -1498,229 +1536,237 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error {
|
||||
u.DisplayGiftsButton = u.Flags2.Has(16)
|
||||
u.NoforwardsMyEnabled = u.Flags2.Has(23)
|
||||
u.NoforwardsPeerEnabled = u.Flags2.Has(24)
|
||||
u.UnofficialSecurityRisk = u.Flags2.Has(26)
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field id: %w", err)
|
||||
}
|
||||
u.ID = value
|
||||
}
|
||||
if u.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field about: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field about: %w", err)
|
||||
}
|
||||
u.About = value
|
||||
}
|
||||
{
|
||||
if err := u.Settings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field settings: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field settings: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(21) {
|
||||
value, err := DecodePhoto(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field personal_photo: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field personal_photo: %w", err)
|
||||
}
|
||||
u.PersonalPhoto = value
|
||||
}
|
||||
if u.Flags.Has(2) {
|
||||
value, err := DecodePhoto(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field profile_photo: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field profile_photo: %w", err)
|
||||
}
|
||||
u.ProfilePhoto = value
|
||||
}
|
||||
if u.Flags.Has(22) {
|
||||
value, err := DecodePhoto(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field fallback_photo: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field fallback_photo: %w", err)
|
||||
}
|
||||
u.FallbackPhoto = value
|
||||
}
|
||||
{
|
||||
if err := u.NotifySettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field notify_settings: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field notify_settings: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(3) {
|
||||
if err := u.BotInfo.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field bot_info: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field bot_info: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(6) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field pinned_msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field pinned_msg_id: %w", err)
|
||||
}
|
||||
u.PinnedMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field common_chats_count: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field common_chats_count: %w", err)
|
||||
}
|
||||
u.CommonChatsCount = value
|
||||
}
|
||||
if u.Flags.Has(11) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field folder_id: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field folder_id: %w", err)
|
||||
}
|
||||
u.FolderID = value
|
||||
}
|
||||
if u.Flags.Has(14) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field ttl_period: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field ttl_period: %w", err)
|
||||
}
|
||||
u.TTLPeriod = value
|
||||
}
|
||||
if u.Flags.Has(15) {
|
||||
value, err := DecodeChatTheme(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field theme: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field theme: %w", err)
|
||||
}
|
||||
u.Theme = value
|
||||
}
|
||||
if u.Flags.Has(16) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field private_forward_name: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field private_forward_name: %w", err)
|
||||
}
|
||||
u.PrivateForwardName = value
|
||||
}
|
||||
if u.Flags.Has(17) {
|
||||
if err := u.BotGroupAdminRights.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field bot_group_admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field bot_group_admin_rights: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(18) {
|
||||
if err := u.BotBroadcastAdminRights.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field bot_broadcast_admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field bot_broadcast_admin_rights: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags.Has(24) {
|
||||
value, err := DecodeWallPaper(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field wallpaper: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field wallpaper: %w", err)
|
||||
}
|
||||
u.Wallpaper = value
|
||||
}
|
||||
if u.Flags.Has(25) {
|
||||
if err := u.Stories.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field stories: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field stories: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(0) {
|
||||
if err := u.BusinessWorkHours.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field business_work_hours: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field business_work_hours: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(1) {
|
||||
if err := u.BusinessLocation.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field business_location: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field business_location: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(2) {
|
||||
if err := u.BusinessGreetingMessage.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field business_greeting_message: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field business_greeting_message: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(3) {
|
||||
if err := u.BusinessAwayMessage.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field business_away_message: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field business_away_message: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(4) {
|
||||
if err := u.BusinessIntro.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field business_intro: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field business_intro: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(5) {
|
||||
if err := u.Birthday.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field birthday: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field birthday: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(6) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field personal_channel_id: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field personal_channel_id: %w", err)
|
||||
}
|
||||
u.PersonalChannelID = value
|
||||
}
|
||||
if u.Flags2.Has(6) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field personal_channel_message: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field personal_channel_message: %w", err)
|
||||
}
|
||||
u.PersonalChannelMessage = value
|
||||
}
|
||||
if u.Flags2.Has(8) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field stargifts_count: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field stargifts_count: %w", err)
|
||||
}
|
||||
u.StargiftsCount = value
|
||||
}
|
||||
if u.Flags2.Has(11) {
|
||||
if err := u.StarrefProgram.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field starref_program: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field starref_program: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(12) {
|
||||
if err := u.BotVerification.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field bot_verification: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field bot_verification: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(14) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field send_paid_messages_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field send_paid_messages_stars: %w", err)
|
||||
}
|
||||
u.SendPaidMessagesStars = value
|
||||
}
|
||||
if u.Flags2.Has(15) {
|
||||
if err := u.DisallowedGifts.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field disallowed_gifts: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field disallowed_gifts: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(17) {
|
||||
if err := u.StarsRating.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field stars_rating: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field stars_rating: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(18) {
|
||||
if err := u.StarsMyPendingRating.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field stars_my_pending_rating: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field stars_my_pending_rating: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(18) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field stars_my_pending_rating_date: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field stars_my_pending_rating_date: %w", err)
|
||||
}
|
||||
u.StarsMyPendingRatingDate = value
|
||||
}
|
||||
if u.Flags2.Has(20) {
|
||||
value, err := DecodeProfileTab(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field main_tab: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field main_tab: %w", err)
|
||||
}
|
||||
u.MainTab = value
|
||||
}
|
||||
if u.Flags2.Has(21) {
|
||||
value, err := DecodeDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field saved_music: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field saved_music: %w", err)
|
||||
}
|
||||
u.SavedMusic = value
|
||||
}
|
||||
if u.Flags2.Has(22) {
|
||||
if err := u.Note.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#a02bc13e: field note: %w", err)
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field note: %w", err)
|
||||
}
|
||||
}
|
||||
if u.Flags2.Has(25) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode userFull#6cbe645: field bot_manager_id: %w", err)
|
||||
}
|
||||
u.BotManagerID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2085,6 +2131,25 @@ func (u *UserFull) GetNoforwardsPeerEnabled() (value bool) {
|
||||
return u.Flags2.Has(24)
|
||||
}
|
||||
|
||||
// SetUnofficialSecurityRisk sets value of UnofficialSecurityRisk conditional field.
|
||||
func (u *UserFull) SetUnofficialSecurityRisk(value bool) {
|
||||
if value {
|
||||
u.Flags2.Set(26)
|
||||
u.UnofficialSecurityRisk = true
|
||||
} else {
|
||||
u.Flags2.Unset(26)
|
||||
u.UnofficialSecurityRisk = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetUnofficialSecurityRisk returns value of UnofficialSecurityRisk conditional field.
|
||||
func (u *UserFull) GetUnofficialSecurityRisk() (value bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Flags2.Has(26)
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (u *UserFull) GetID() (value int64) {
|
||||
if u == nil {
|
||||
@@ -2711,6 +2776,24 @@ func (u *UserFull) GetNote() (value TextWithEntities, ok bool) {
|
||||
return u.Note, true
|
||||
}
|
||||
|
||||
// SetBotManagerID sets value of BotManagerID conditional field.
|
||||
func (u *UserFull) SetBotManagerID(value int64) {
|
||||
u.Flags2.Set(25)
|
||||
u.BotManagerID = value
|
||||
}
|
||||
|
||||
// GetBotManagerID returns value of BotManagerID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *UserFull) GetBotManagerID() (value int64, ok bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
if !u.Flags2.Has(25) {
|
||||
return value, false
|
||||
}
|
||||
return u.BotManagerID, true
|
||||
}
|
||||
|
||||
// GetPersonalPhotoAsNotEmpty returns mapped value of PersonalPhoto conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (u *UserFull) GetPersonalPhotoAsNotEmpty() (*Photo, bool) {
|
||||
|
||||
Generated
+35
@@ -313,6 +313,8 @@ type User struct {
|
||||
BotForumView bool
|
||||
// BotForumCanManageTopics field of User.
|
||||
BotForumCanManageTopics bool
|
||||
// BotCanManageBots field of User.
|
||||
BotCanManageBots bool
|
||||
// ID of the user, see here »¹ for more info and the available ID range.
|
||||
//
|
||||
// Links:
|
||||
@@ -598,6 +600,9 @@ func (u *User) Zero() bool {
|
||||
if !(u.BotForumCanManageTopics == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.BotCanManageBots == false) {
|
||||
return false
|
||||
}
|
||||
if !(u.ID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -700,6 +705,7 @@ func (u *User) FillFrom(from interface {
|
||||
GetBotHasMainApp() (value bool)
|
||||
GetBotForumView() (value bool)
|
||||
GetBotForumCanManageTopics() (value bool)
|
||||
GetBotCanManageBots() (value bool)
|
||||
GetID() (value int64)
|
||||
GetAccessHash() (value int64, ok bool)
|
||||
GetFirstName() (value string, ok bool)
|
||||
@@ -748,6 +754,7 @@ func (u *User) FillFrom(from interface {
|
||||
u.BotHasMainApp = from.GetBotHasMainApp()
|
||||
u.BotForumView = from.GetBotForumView()
|
||||
u.BotForumCanManageTopics = from.GetBotForumCanManageTopics()
|
||||
u.BotCanManageBots = from.GetBotCanManageBots()
|
||||
u.ID = from.GetID()
|
||||
if val, ok := from.GetAccessHash(); ok {
|
||||
u.AccessHash = val
|
||||
@@ -985,6 +992,11 @@ func (u *User) TypeInfo() tdp.Type {
|
||||
SchemaName: "bot_forum_can_manage_topics",
|
||||
Null: !u.Flags2.Has(17),
|
||||
},
|
||||
{
|
||||
Name: "BotCanManageBots",
|
||||
SchemaName: "bot_can_manage_bots",
|
||||
Null: !u.Flags2.Has(18),
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
@@ -1171,6 +1183,9 @@ func (u *User) SetFlags() {
|
||||
if !(u.BotForumCanManageTopics == false) {
|
||||
u.Flags2.Set(17)
|
||||
}
|
||||
if !(u.BotCanManageBots == false) {
|
||||
u.Flags2.Set(18)
|
||||
}
|
||||
if !(u.AccessHash == 0) {
|
||||
u.Flags.Set(0)
|
||||
}
|
||||
@@ -1402,6 +1417,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error {
|
||||
u.BotHasMainApp = u.Flags2.Has(13)
|
||||
u.BotForumView = u.Flags2.Has(16)
|
||||
u.BotForumCanManageTopics = u.Flags2.Has(17)
|
||||
u.BotCanManageBots = u.Flags2.Has(18)
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
@@ -2076,6 +2092,25 @@ func (u *User) GetBotForumCanManageTopics() (value bool) {
|
||||
return u.Flags2.Has(17)
|
||||
}
|
||||
|
||||
// SetBotCanManageBots sets value of BotCanManageBots conditional field.
|
||||
func (u *User) SetBotCanManageBots(value bool) {
|
||||
if value {
|
||||
u.Flags2.Set(18)
|
||||
u.BotCanManageBots = true
|
||||
} else {
|
||||
u.Flags2.Unset(18)
|
||||
u.BotCanManageBots = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetBotCanManageBots returns value of BotCanManageBots conditional field.
|
||||
func (u *User) GetBotCanManageBots() (value bool) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Flags2.Has(18)
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (u *User) GetID() (value int64) {
|
||||
if u == nil {
|
||||
|
||||
Reference in New Issue
Block a user