API Layer 152: emoji pfp, autosave medias, auto-translations, media permissions, Firebase...

This commit is contained in:
Wizou 2023-02-04 10:36:19 +01:00
parent 553934c5ad
commit f86291117f
7 changed files with 547 additions and 117 deletions

View file

@ -373,6 +373,7 @@ var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get
await client.Messages_ImportChatInvite("HASH"); // join the channel/group
// Note: This works also with HASH invite links from public channel/group
```
Note: `CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite)
<a name="add-members"></a>
## Add/Invite/Remove someone in a chat

View file

@ -1,4 +1,4 @@
[![API Layer](https://img.shields.io/badge/API_Layer-151-blueviolet)](https://corefork.telegram.org/methods)
[![API Layer](https://img.shields.io/badge/API_Layer-152-blueviolet)](https://corefork.telegram.org/methods)
[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/)
[![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7)
[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate)

View file

@ -1016,29 +1016,31 @@ namespace WTelegram
User = null;
}
phone_number ??= Config("phone_number");
Auth_SentCode sentCode;
Auth_SentCodeBase sentCodeBase;
#pragma warning disable CS0618 // Auth_* methods are marked as obsolete
try
{
sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash ??= Config("api_hash"), settings ??= new());
sentCodeBase = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash ??= Config("api_hash"), settings ??= new());
}
catch (RpcException ex) when (ex.Code == 500 && ex.Message == "AUTH_RESTART")
{
sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings);
sentCodeBase = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings);
}
Auth_AuthorizationBase authorization = null;
string phone_code_hash = null;
try
{
if (sentCode.type is Auth_SentCodeTypeSetUpEmailRequired setupEmail)
if (sentCodeBase is Auth_SentCode { type: Auth_SentCodeTypeSetUpEmailRequired setupEmail } setupSentCode)
{
phone_code_hash = setupSentCode.phone_code_hash;
Helpers.Log(3, "A login email is required");
RaiseUpdate(sentCode);
RaiseUpdate(sentCodeBase);
var email = _config("email");
if (string.IsNullOrEmpty(email))
sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash);
sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash);
else
{
var purpose = new EmailVerifyPurposeLoginSetup { phone_number = phone_number, phone_code_hash = sentCode.phone_code_hash };
var purpose = new EmailVerifyPurposeLoginSetup { phone_number = phone_number, phone_code_hash = phone_code_hash };
if (email is not "Google" and not "Apple")
{
var sentEmail = await this.Account_SendVerifyEmailCode(purpose, email);
@ -1063,55 +1065,61 @@ namespace WTelegram
if (retry >= MaxCodePwdAttempts) throw;
}
if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be)
sentCode = verifiedLogin.sent_code;
sentCodeBase = verifiedLogin.sent_code;
}
}
resent:
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout);
Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}");
RaiseUpdate(sentCode);
for (int retry = 1; authorization == null; retry++)
try
{
var verification_code = await ConfigAsync("verification_code");
if (verification_code == "" && sentCode.next_type != 0)
if (sentCodeBase is Auth_SentCodeSuccess success)
authorization = success.authorization;
else if (sentCodeBase is Auth_SentCode sentCode)
{
phone_code_hash = sentCode.phone_code_hash;
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout);
Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}");
RaiseUpdate(sentCode);
for (int retry = 1; authorization == null; retry++)
try
{
var mustWait = timeout - DateTime.UtcNow;
if (mustWait.Ticks > 0)
var verification_code = await ConfigAsync("verification_code");
if (verification_code == "" && sentCode.next_type != 0)
{
Helpers.Log(3, $"You must wait {(int)(mustWait.TotalSeconds + 0.5)} more seconds before requesting the code to be sent via {sentCode.next_type}");
continue;
var mustWait = timeout - DateTime.UtcNow;
if (mustWait.Ticks > 0)
{
Helpers.Log(3, $"You must wait {(int)(mustWait.TotalSeconds + 0.5)} more seconds before requesting the code to be sent via {sentCode.next_type}");
continue;
}
sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash);
goto resent;
}
sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash);
goto resent;
authorization = await this.Auth_SignIn(phone_number, phone_code_hash, verification_code);
}
authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code);
}
catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID")
{
Helpers.Log(4, "Wrong verification code!");
if (retry >= MaxCodePwdAttempts) throw;
}
catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED")
{
for (int pwdRetry = 1; authorization == null; pwdRetry++)
try
{
var accountPassword = await this.Account_GetPassword();
RaiseUpdate(accountPassword);
var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password"));
authorization = await this.Auth_CheckPassword(checkPasswordSRP);
}
catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID")
{
Helpers.Log(4, "Wrong password!");
if (pwdRetry >= MaxCodePwdAttempts) throw;
}
}
catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID")
{
Helpers.Log(4, "Wrong verification code!");
if (retry >= MaxCodePwdAttempts) throw;
}
catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED")
{
for (int pwdRetry = 1; authorization == null; pwdRetry++)
try
{
var accountPassword = await this.Account_GetPassword();
RaiseUpdate(accountPassword);
var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password"));
authorization = await this.Auth_CheckPassword(checkPasswordSRP);
}
catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID")
{
Helpers.Log(4, "Wrong password!");
if (pwdRetry >= MaxCodePwdAttempts) throw;
}
}
}
}
catch (Exception ex) when (ex is not RpcException { Message: "FLOOD_WAIT_X" })
{
try { await this.Auth_CancelCode(phone_number, sentCode.phone_code_hash); } catch { }
try { await this.Auth_CancelCode(phone_number, phone_code_hash); } catch { }
throw;
}
if (authorization is Auth_AuthorizationSignUpRequired signUpRequired)
@ -1122,7 +1130,7 @@ namespace WTelegram
var last_name = Config("last_name");
var wait = waitUntil - DateTime.UtcNow;
if (wait > TimeSpan.Zero) await Task.Delay(wait); // we get a FLOOD_WAIT_3 if we SignUp too fast
authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name);
authorization = await this.Auth_SignUp(phone_number, phone_code_hash, first_name, last_name);
}
#pragma warning restore CS0618
LoginAlreadyDone(authorization);

View file

@ -452,7 +452,7 @@ namespace TL
/// <remarks>a <see langword="null"/> value means <a href="https://corefork.telegram.org/constructor/inputChatPhotoEmpty">inputChatPhotoEmpty</a></remarks>
public abstract class InputChatPhotoBase : IObject { }
/// <summary>New photo to be set as group profile photo. <para>See <a href="https://corefork.telegram.org/constructor/inputChatUploadedPhoto"/></para></summary>
[TLDef(0xC642724E)]
[TLDef(0xBDCDAEC0)]
public class InputChatUploadedPhoto : InputChatPhotoBase
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
@ -463,6 +463,7 @@ namespace TL
[IfFlag(1)] public InputFileBase video;
/// <summary>Timestamp that should be shown as static preview to the user (seconds)</summary>
[IfFlag(2)] public double video_start_ts;
[IfFlag(3)] public VideoSizeBase video_emoji_markup;
[Flags] public enum Flags : uint
{
@ -472,6 +473,8 @@ namespace TL
has_video = 0x2,
/// <summary>Field <see cref="video_start_ts"/> has a value</summary>
has_video_start_ts = 0x4,
/// <summary>Field <see cref="video_emoji_markup"/> has a value</summary>
has_video_emoji_markup = 0x8,
}
}
/// <summary>Existing photo to be set as a chat profile photo. <para>See <a href="https://corefork.telegram.org/constructor/inputChatPhoto"/></para></summary>
@ -1169,6 +1172,7 @@ namespace TL
has_requests_pending = 0x20000,
/// <summary>Field <see cref="available_reactions"/> has a value</summary>
has_available_reactions = 0x40000,
translations_disabled = 0x80000,
}
/// <summary>ID of the chat</summary>
@ -1353,6 +1357,7 @@ namespace TL
can_delete_channel = 0x1,
antispam = 0x2,
participants_hidden = 0x4,
translations_disabled = 0x8,
}
/// <summary>ID of the channel</summary>
@ -2213,6 +2218,13 @@ namespace TL
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/messageActionAttachMenuBotAllowed"/></para></summary>
[TLDef(0xE7E75F97)]
public class MessageActionAttachMenuBotAllowed : MessageAction { }
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/messageActionRequestedPeer"/></para></summary>
[TLDef(0xFE77345D)]
public class MessageActionRequestedPeer : MessageAction
{
public int button_id;
public Peer peer;
}
/// <summary>Chat info. <para>See <a href="https://corefork.telegram.org/type/Dialog"/></para> <para>Derived classes: <see cref="Dialog"/>, <see cref="DialogFolder"/></para></summary>
public abstract class DialogBase : IObject
@ -2332,7 +2344,7 @@ namespace TL
/// <summary>Available sizes for download</summary>
public PhotoSizeBase[] sizes;
/// <summary><a href="https://corefork.telegram.org/api/files#animated-profile-pictures">For animated profiles</a>, the MPEG4 videos</summary>
[IfFlag(1)] public VideoSize[] video_sizes;
[IfFlag(1)] public VideoSizeBase[] video_sizes;
/// <summary>DC ID to use for download</summary>
public int dc_id;
@ -2457,9 +2469,11 @@ namespace TL
}
}
/// <summary>Contains info on a confirmation code message sent via SMS, phone call or Telegram. <para>See <a href="https://corefork.telegram.org/type/auth.SentCode"/></para> <para>Derived classes: <see cref="Auth_SentCode"/></para></summary>
public abstract class Auth_SentCodeBase : IObject { }
/// <summary>Contains info about a sent verification code. <para>See <a href="https://corefork.telegram.org/constructor/auth.sentCode"/></para></summary>
[TLDef(0x5E002502)]
public class Auth_SentCode : IObject
public class Auth_SentCode : Auth_SentCodeBase
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
public Flags flags;
@ -2480,11 +2494,17 @@ namespace TL
has_timeout = 0x4,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/auth.sentCodeSuccess"/></para></summary>
[TLDef(0x2390FE44)]
public class Auth_SentCodeSuccess : Auth_SentCodeBase
{
public Auth_AuthorizationBase authorization;
}
/// <summary>Object contains info on user authorization. <para>See <a href="https://corefork.telegram.org/type/auth.Authorization"/></para> <para>Derived classes: <see cref="Auth_Authorization"/>, <see cref="Auth_AuthorizationSignUpRequired"/></para></summary>
public abstract class Auth_AuthorizationBase : IObject { }
/// <summary>Contains user authorization info. <para>See <a href="https://corefork.telegram.org/constructor/auth.authorization"/></para></summary>
[TLDef(0x33FB7BB8)]
[TLDef(0x2EA2C0D4)]
public class Auth_Authorization : Auth_AuthorizationBase
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
@ -2493,6 +2513,7 @@ namespace TL
[IfFlag(1)] public int otherwise_relogin_days;
/// <summary>Temporary <a href="https://corefork.telegram.org/passport">passport</a> sessions</summary>
[IfFlag(0)] public int tmp_sessions;
[IfFlag(2)] public byte[] future_auth_token;
/// <summary>Info on authorized user</summary>
public UserBase user;
@ -2502,6 +2523,8 @@ namespace TL
has_tmp_sessions = 0x1,
/// <summary>Suggests the user to set up a 2-step verification password to be able to log in again</summary>
setup_password_required = 0x2,
/// <summary>Field <see cref="future_auth_token"/> has a value</summary>
has_future_auth_token = 0x4,
}
}
/// <summary>An account with this phone number doesn't exist on telegram: the user has to <a href="https://corefork.telegram.org/api/auth">enter basic information and sign up</a> <para>See <a href="https://corefork.telegram.org/constructor/auth.authorizationSignUpRequired"/></para></summary>
@ -2837,6 +2860,7 @@ namespace TL
has_personal_photo = 0x200000,
/// <summary>Field <see cref="fallback_photo"/> has a value</summary>
has_fallback_photo = 0x400000,
translations_disabled = 0x800000,
}
}
@ -4414,6 +4438,9 @@ namespace TL
{
public long user_id;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/updateAutoSaveSettings"/></para></summary>
[TLDef(0xEC05B097)]
public class UpdateAutoSaveSettings : Update { }
/// <summary>Updates state. <para>See <a href="https://corefork.telegram.org/constructor/updates.state"/></para></summary>
[TLDef(0xA56C2A3E)]
@ -5377,7 +5404,7 @@ namespace TL
/// <summary>Thumbnails</summary>
[IfFlag(0)] public PhotoSizeBase[] thumbs;
/// <summary>Video thumbnails</summary>
[IfFlag(1)] public VideoSize[] video_thumbs;
[IfFlag(1)] public VideoSizeBase[] video_thumbs;
/// <summary>DC ID</summary>
public int dc_id;
/// <summary>Attributes</summary>
@ -6574,6 +6601,13 @@ namespace TL
public class KeyboardButtonSimpleWebView : KeyboardButtonWebView
{
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/keyboardButtonRequestPeer"/></para></summary>
[TLDef(0x0D0B468C, inheritBefore = true)]
public class KeyboardButtonRequestPeer : KeyboardButton
{
public int button_id;
public RequestPeerType peer_type;
}
/// <summary>Inline keyboard row <para>See <a href="https://corefork.telegram.org/constructor/keyboardButtonRow"/></para></summary>
[TLDef(0x77608B83)]
@ -7863,6 +7897,21 @@ namespace TL
{
public string url;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/auth.sentCodeTypeFirebaseSms"/></para></summary>
[TLDef(0xE57B1432)]
public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms
{
public Flags flags;
[IfFlag(0)] public byte[] nonce;
[IfFlag(1)] public string receipt;
[IfFlag(1)] public int push_timeout;
[Flags] public enum Flags : uint
{
has_nonce = 0x1,
has_receipt = 0x2,
}
}
/// <summary>Callback answer sent by the bot in response to a button press <para>See <a href="https://corefork.telegram.org/constructor/messages.botCallbackAnswer"/></para></summary>
[TLDef(0x36585EA4)]
@ -11378,6 +11427,13 @@ namespace TL
/// <summary>If set, does not allow any user to pin messages in a <a href="https://corefork.telegram.org/api/channel">supergroup/chat</a></summary>
pin_messages = 0x20000,
manage_topics = 0x40000,
send_photos = 0x80000,
send_videos = 0x100000,
send_roundvideos = 0x200000,
send_audios = 0x400000,
send_voices = 0x800000,
send_docs = 0x1000000,
send_plain = 0x2000000,
}
}
@ -11419,13 +11475,15 @@ namespace TL
}
/// <summary>Settings used by telegram servers for sending the confirm code. <para>See <a href="https://corefork.telegram.org/constructor/codeSettings"/></para></summary>
[TLDef(0x8A6469C2)]
[TLDef(0xAD253D78)]
public class CodeSettings : IObject
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
public Flags flags;
/// <summary>Previously stored logout tokens, see <a href="https://corefork.telegram.org/api/auth#logout-tokens">the documentation for more info »</a></summary>
[IfFlag(6)] public byte[][] logout_tokens;
[IfFlag(8)] public string token;
[IfFlag(8)] public bool app_sandbox;
[Flags] public enum Flags : uint
{
@ -11439,6 +11497,9 @@ namespace TL
allow_missed_call = 0x20,
/// <summary>Field <see cref="logout_tokens"/> has a value</summary>
has_logout_tokens = 0x40,
allow_firebase = 0x80,
/// <summary>Field <see cref="token"/> has a value</summary>
has_token = 0x100,
}
}
@ -12241,9 +12302,11 @@ namespace TL
public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats);
}
/// <summary>Represents an animated video thumbnail <para>See <a href="https://corefork.telegram.org/type/VideoSize"/></para> <para>Derived classes: <see cref="VideoSize"/></para></summary>
public abstract class VideoSizeBase : IObject { }
/// <summary><a href="https://corefork.telegram.org/api/files#animated-profile-pictures">Animated profile picture</a> in MPEG4 format <para>See <a href="https://corefork.telegram.org/constructor/videoSize"/></para></summary>
[TLDef(0xDE33B094)]
public class VideoSize : IObject
public class VideoSize : VideoSizeBase
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
public Flags flags;
@ -12264,6 +12327,21 @@ namespace TL
has_video_start_ts = 0x1,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/videoSizeEmojiMarkup"/></para></summary>
[TLDef(0xF85C413C)]
public class VideoSizeEmojiMarkup : VideoSizeBase
{
public long emoji_id;
public int[] background_colors;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/videoSizeStickerMarkup"/></para></summary>
[TLDef(0x0DA082FE)]
public class VideoSizeStickerMarkup : VideoSizeBase
{
public InputStickerSet stickerset;
public long sticker_id;
public int[] background_colors;
}
/// <summary>Information about an active user in a supergroup <para>See <a href="https://corefork.telegram.org/constructor/statsGroupTopPoster"/></para></summary>
[TLDef(0x9D04AF9B)]
@ -13354,19 +13432,6 @@ namespace TL
public AvailableReaction[] reactions;
}
/// <summary>Translated text, or no result <para>See <a href="https://corefork.telegram.org/type/messages.TranslatedText"/></para> <para>Derived classes: <see cref="Messages_TranslateNoResult"/>, <see cref="Messages_TranslateResultText"/></para></summary>
public abstract class Messages_TranslatedText : IObject { }
/// <summary>No translation is available <para>See <a href="https://corefork.telegram.org/constructor/messages.translateNoResult"/></para></summary>
[TLDef(0x67CA4737)]
public class Messages_TranslateNoResult : Messages_TranslatedText { }
/// <summary>Translated text <para>See <a href="https://corefork.telegram.org/constructor/messages.translateResultText"/></para></summary>
[TLDef(0xA214F7D0)]
public class Messages_TranslateResultText : Messages_TranslatedText
{
/// <summary>Translated text</summary>
public string text;
}
/// <summary>How a certain peer reacted to the message <para>See <a href="https://corefork.telegram.org/constructor/messagePeerReaction"/></para></summary>
[TLDef(0xB156FE9C)]
public class MessagePeerReaction : IObject
@ -13685,6 +13750,7 @@ namespace TL
{
/// <summary>Pass true if this is a restore of a Telegram Premium purchase; only for the App Store</summary>
restore = 0x1,
upgrade = 0x2,
}
}
/// <summary>Info about a gifted Telegram Premium purchase <para>See <a href="https://corefork.telegram.org/constructor/inputStorePaymentGiftPremium"/></para></summary>
@ -13867,15 +13933,16 @@ namespace TL
public class Account_EmailVerifiedLogin : Account_EmailVerified
{
/// <summary>Info about the sent <a href="https://corefork.telegram.org/api/auth">login code</a></summary>
public Auth_SentCode sent_code;
public Auth_SentCodeBase sent_code;
}
/// <summary>Describes a Telegram Premium subscription option <para>See <a href="https://corefork.telegram.org/constructor/premiumSubscriptionOption"/></para></summary>
[TLDef(0xB6F11EBE)]
[TLDef(0x5F2D1DF2)]
public class PremiumSubscriptionOption : IObject
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
public Flags flags;
[IfFlag(3)] public string transaction;
/// <summary>Duration of subscription in months</summary>
public int months;
/// <summary>Three-letter ISO 4217 <a href="https://corefork.telegram.org/bots/payments#supported-currencies">currency</a> code</summary>
@ -13893,6 +13960,8 @@ namespace TL
has_store_product = 0x1,
current = 0x2,
can_purchase_upgrade = 0x4,
/// <summary>Field <see cref="transaction"/> has a value</summary>
has_transaction = 0x8,
}
}
@ -14041,4 +14110,139 @@ namespace TL
public string url;
public DateTime expires;
}
/// <summary><para>See <a href="https://corefork.telegram.org/type/RequestPeerType"/></para></summary>
public abstract class RequestPeerType : IObject { }
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/requestPeerTypeUser"/></para></summary>
[TLDef(0x5F3B8A00)]
public class RequestPeerTypeUser : RequestPeerType
{
public Flags flags;
[IfFlag(0)] public bool bot;
[IfFlag(1)] public bool premium;
[Flags] public enum Flags : uint
{
has_bot = 0x1,
has_premium = 0x2,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/requestPeerTypeChat"/></para></summary>
[TLDef(0xC9F06E1B)]
public class RequestPeerTypeChat : RequestPeerType
{
public Flags flags;
[IfFlag(3)] public bool has_username;
[IfFlag(4)] public bool forum;
[IfFlag(1)] public ChatAdminRights user_admin_rights;
[IfFlag(2)] public ChatAdminRights bot_admin_rights;
[Flags] public enum Flags : uint
{
creator = 0x1,
has_user_admin_rights = 0x2,
has_bot_admin_rights = 0x4,
has_has_username = 0x8,
has_forum = 0x10,
bot_participant = 0x20,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/requestPeerTypeBroadcast"/></para></summary>
[TLDef(0x339BEF6C)]
public class RequestPeerTypeBroadcast : RequestPeerType
{
public Flags flags;
[IfFlag(3)] public bool has_username;
[IfFlag(1)] public ChatAdminRights user_admin_rights;
[IfFlag(2)] public ChatAdminRights bot_admin_rights;
[Flags] public enum Flags : uint
{
creator = 0x1,
has_user_admin_rights = 0x2,
has_bot_admin_rights = 0x4,
has_has_username = 0x8,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/emojiList"/></para></summary>
/// <remarks>a <see langword="null"/> value means <a href="https://corefork.telegram.org/constructor/emojiListNotModified">emojiListNotModified</a></remarks>
[TLDef(0x7A1E11D1)]
public class EmojiList : IObject
{
public long hash;
public long[] document_id;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/emojiGroup"/></para></summary>
[TLDef(0x7A9ABDA9)]
public class EmojiGroup : IObject
{
public string title;
public long icon_emoji_id;
public string[] emoticons;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/messages.emojiGroups"/></para></summary>
/// <remarks>a <see langword="null"/> value means <a href="https://corefork.telegram.org/constructor/messages.emojiGroupsNotModified">messages.emojiGroupsNotModified</a></remarks>
[TLDef(0x881FB94B)]
public class Messages_EmojiGroups : IObject
{
public int hash;
public EmojiGroup[] groups;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/textWithEntities"/></para></summary>
[TLDef(0x751F3146)]
public class TextWithEntities : IObject
{
public string text;
public MessageEntity[] entities;
}
/// <summary>Translated text, or no result <para>See <a href="https://corefork.telegram.org/type/messages.TranslatedText"/></para> <para>Derived classes: <see cref="Messages_TranslateNoResult"/>, <see cref="Messages_TranslateResultText"/></para></summary>
public abstract class Messages_TranslatedText : IObject { }
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/messages.translateResult"/></para></summary>
[TLDef(0x33DB32F8)]
public class Messages_TranslateResult : Messages_TranslatedText
{
public TextWithEntities[] result;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/autoSaveSettings"/></para></summary>
[TLDef(0xC84834CE)]
public class AutoSaveSettings : IObject
{
public Flags flags;
[IfFlag(2)] public long video_max_size;
[Flags] public enum Flags : uint
{
photos = 0x1,
videos = 0x2,
has_video_max_size = 0x4,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/autoSaveException"/></para></summary>
[TLDef(0x81602D47)]
public class AutoSaveException : IObject
{
public Peer peer;
public AutoSaveSettings settings;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/account.autoSaveSettings"/></para></summary>
[TLDef(0x4C3E069D)]
public class Account_AutoSaveSettings : IObject, IPeerResolver
{
public AutoSaveSettings users_settings;
public AutoSaveSettings chats_settings;
public AutoSaveSettings broadcasts_settings;
public AutoSaveException[] exceptions;
public Dictionary<long, ChatBase> chats;
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
}

View file

@ -98,7 +98,7 @@ namespace TL
/// <param name="api_hash">Application secret hash (see <a href="https://corefork.telegram.org/myapp">App configuration</a>)</param>
/// <param name="settings">Settings for the code type to send</param>
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task<Auth_SentCode> Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings)
public static Task<Auth_SentCodeBase> Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings)
=> client.Invoke(new Auth_SendCode
{
phone_number = phone_number,
@ -224,7 +224,7 @@ namespace TL
/// <param name="phone_number">The phone number</param>
/// <param name="phone_code_hash">The phone code hash obtained from <see cref="Auth_SendCode">Auth_SendCode</see></param>
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task<Auth_SentCode> Auth_ResendCode(this Client client, string phone_number, string phone_code_hash)
public static Task<Auth_SentCodeBase> Auth_ResendCode(this Client client, string phone_number, string phone_code_hash)
=> client.Invoke(new Auth_ResendCode
{
phone_number = phone_number,
@ -295,6 +295,17 @@ namespace TL
web_auth_token = web_auth_token,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.requestFirebaseSms"/></para></summary>
public static Task<bool> Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null)
=> client.Invoke(new Auth_RequestFirebaseSms
{
flags = (Auth_RequestFirebaseSms.Flags)((safety_net_token != null ? 0x1 : 0) | (ios_push_secret != null ? 0x2 : 0)),
phone_number = phone_number,
phone_code_hash = phone_code_hash,
safety_net_token = safety_net_token,
ios_push_secret = ios_push_secret,
});
/// <summary>Register device to receive <a href="https://corefork.telegram.org/api/push-updates">PUSH notifications</a> <para>See <a href="https://corefork.telegram.org/method/account.registerDevice"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.registerDevice#possible-errors">details</a>)</para></summary>
/// <param name="no_muted">Avoid receiving (silent and invisible background) notifications. Useful to save battery.</param>
/// <param name="token_type">Device token type, see <a href="https://corefork.telegram.org/api/push-updates#subscribing-to-notifications">PUSH updates</a> for the possible values.</param>
@ -453,7 +464,7 @@ namespace TL
/// <summary>Verify a new phone number to associate to the current account <para>See <a href="https://corefork.telegram.org/method/account.sendChangePhoneCode"/></para> <para>Possible <see cref="RpcException"/> codes: 400,406 (<a href="https://corefork.telegram.org/method/account.sendChangePhoneCode#possible-errors">details</a>)</para></summary>
/// <param name="phone_number">New phone number</param>
/// <param name="settings">Phone code settings</param>
public static Task<Auth_SentCode> Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings)
public static Task<Auth_SentCodeBase> Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings)
=> client.Invoke(new Account_SendChangePhoneCode
{
phone_number = phone_number,
@ -521,7 +532,7 @@ namespace TL
/// <summary>Send confirmation code to cancel account deletion, for more info <a href="https://corefork.telegram.org/api/account-deletion">click here »</a> <para>See <a href="https://corefork.telegram.org/method/account.sendConfirmPhoneCode"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.sendConfirmPhoneCode#possible-errors">details</a>)</para></summary>
/// <param name="hash">The hash from the service notification, for more info <a href="https://corefork.telegram.org/api/account-deletion">click here »</a></param>
/// <param name="settings">Phone code settings</param>
public static Task<Auth_SentCode> Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings)
public static Task<Auth_SentCodeBase> Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings)
=> client.Invoke(new Account_SendConfirmPhoneCode
{
hash = hash,
@ -631,7 +642,7 @@ namespace TL
/// <summary>Send the verification phone code for telegram <a href="https://corefork.telegram.org/passport">passport</a>. <para>See <a href="https://corefork.telegram.org/method/account.sendVerifyPhoneCode"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.sendVerifyPhoneCode#possible-errors">details</a>)</para></summary>
/// <param name="phone_number">The phone number to verify</param>
/// <param name="settings">Phone code settings</param>
public static Task<Auth_SentCode> Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings)
public static Task<Auth_SentCodeBase> Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings)
=> client.Invoke(new Account_SendVerifyPhoneCode
{
phone_number = phone_number,
@ -1066,6 +1077,43 @@ namespace TL
active = active,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.getDefaultProfilePhotoEmojis"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/emojiListNotModified">emojiListNotModified</a></returns>
public static Task<EmojiList> Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultProfilePhotoEmojis
{
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.getDefaultGroupPhotoEmojis"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/emojiListNotModified">emojiListNotModified</a></returns>
public static Task<EmojiList> Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultGroupPhotoEmojis
{
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.getAutoSaveSettings"/></para></summary>
public static Task<Account_AutoSaveSettings> Account_GetAutoSaveSettings(this Client client)
=> client.Invoke(new Account_GetAutoSaveSettings
{
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.saveAutoSaveSettings"/></para></summary>
public static Task<bool> Account_SaveAutoSaveSettings(this Client client, AutoSaveSettings settings, InputPeer peer = null, bool users = false, bool chats = false, bool broadcasts = false)
=> client.Invoke(new Account_SaveAutoSaveSettings
{
flags = (Account_SaveAutoSaveSettings.Flags)((peer != null ? 0x8 : 0) | (users ? 0x1 : 0) | (chats ? 0x2 : 0) | (broadcasts ? 0x4 : 0)),
peer = peer,
settings = settings,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.deleteAutoSaveExceptions"/></para></summary>
public static Task<bool> Account_DeleteAutoSaveExceptions(this Client client)
=> client.Invoke(new Account_DeleteAutoSaveExceptions
{
});
/// <summary>Returns basic user info according to their identifiers. <para>See <a href="https://corefork.telegram.org/method/users.getUsers"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/users.getUsers#possible-errors">details</a>)</para></summary>
/// <param name="id">List of user identifiers</param>
public static Task<UserBase[]> Users_GetUsers(this Client client, params InputUserBase[] id)
@ -1455,7 +1503,7 @@ namespace TL
/// <param name="peer">The destination where the message will be sent</param>
/// <param name="reply_to_msg_id">The message ID to which this message will reply to</param>
/// <param name="message">The message</param>
/// <param name="random_id">Unique client message ID required to prevent message resending</param>
/// <param name="random_id">Unique client message ID required to prevent message resending <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="reply_markup">Reply markup for sending bot buttons</param>
/// <param name="entities">Message <a href="https://corefork.telegram.org/api/entities">entities</a> for sending styled text</param>
/// <param name="schedule_date">Scheduled message date for <a href="https://corefork.telegram.org/api/scheduled-messages">scheduled messages</a></param>
@ -1485,7 +1533,7 @@ namespace TL
/// <param name="reply_to_msg_id">Message ID to which this message should reply to</param>
/// <param name="media">Attached media</param>
/// <param name="message">Caption</param>
/// <param name="random_id">Random ID to avoid resending the same message</param>
/// <param name="random_id">Random ID to avoid resending the same message <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="reply_markup">Reply markup for bot keyboards</param>
/// <param name="entities">Message <a href="https://corefork.telegram.org/api/entities">entities</a> for styled text</param>
/// <param name="schedule_date">Scheduled message date for <a href="https://corefork.telegram.org/api/scheduled-messages">scheduled messages</a></param>
@ -1515,7 +1563,7 @@ namespace TL
/// <param name="noforwards">Only for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more">content protection</a> enabled</param>
/// <param name="from_peer">Source of messages</param>
/// <param name="id">IDs of messages</param>
/// <param name="random_id">Random ID to prevent resending of messages</param>
/// <param name="random_id">Random ID to prevent resending of messages <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="to_peer">Destination peer</param>
/// <param name="schedule_date">Scheduled message date for scheduled messages</param>
/// <param name="send_as">Forward the messages as the specified peer</param>
@ -1701,7 +1749,7 @@ namespace TL
/// <summary>Sends a text message to a secret chat. <para>See <a href="https://corefork.telegram.org/method/messages.sendEncrypted"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/messages.sendEncrypted#possible-errors">details</a>)</para></summary>
/// <param name="silent">Send encrypted message without a notification</param>
/// <param name="peer">Secret chat ID</param>
/// <param name="random_id">Unique client message ID, necessary to avoid message resending</param>
/// <param name="random_id">Unique client message ID, necessary to avoid message resending <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="data">TL-serialization of <see cref="DecryptedMessageBase"/> type, encrypted with a key that was created during chat initialization</param>
public static Task<Messages_SentEncryptedMessage> Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false)
=> client.Invoke(new Messages_SendEncrypted
@ -1715,7 +1763,7 @@ namespace TL
/// <summary>Sends a message with a file attachment to a secret chat <para>See <a href="https://corefork.telegram.org/method/messages.sendEncryptedFile"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.sendEncryptedFile#possible-errors">details</a>)</para></summary>
/// <param name="silent">Whether to send the file without triggering a notification</param>
/// <param name="peer">Secret chat ID</param>
/// <param name="random_id">Unique client message ID necessary to prevent message resending</param>
/// <param name="random_id">Unique client message ID necessary to prevent message resending <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="data">TL-serialization of <see cref="DecryptedMessageBase"/> type, encrypted with a key generated during chat initialization</param>
/// <param name="file">File attachment for the secret chat</param>
public static Task<Messages_SentEncryptedMessage> Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false)
@ -1730,7 +1778,7 @@ namespace TL
/// <summary>Sends a service message to a secret chat. <para>See <a href="https://corefork.telegram.org/method/messages.sendEncryptedService"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/messages.sendEncryptedService#possible-errors">details</a>)</para></summary>
/// <param name="peer">Secret chat ID</param>
/// <param name="random_id">Unique client message ID required to prevent message resending</param>
/// <param name="random_id">Unique client message ID required to prevent message resending <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="data">TL-serialization of <see cref="DecryptedMessageBase"/> type, encrypted with a key generated during chat initialization</param>
public static Task<Messages_SentEncryptedMessage> Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data)
=> client.Invoke(new Messages_SendEncryptedService
@ -1861,7 +1909,7 @@ namespace TL
/// <summary>Start a conversation with a bot using a <a href="https://corefork.telegram.org/api/links#bot-links">deep linking parameter</a> <para>See <a href="https://corefork.telegram.org/method/messages.startBot"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403,500 (<a href="https://corefork.telegram.org/method/messages.startBot#possible-errors">details</a>)</para></summary>
/// <param name="bot">The bot</param>
/// <param name="peer">The chat where to start the bot, can be the bot's private chat or a group</param>
/// <param name="random_id">Random ID to avoid resending the same message</param>
/// <param name="random_id">Random ID to avoid resending the same message <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="start_param"><a href="https://corefork.telegram.org/api/links#bot-links">Deep linking parameter</a></param>
public static Task<UpdatesBase> Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param)
=> client.Invoke(new Messages_StartBot
@ -2014,7 +2062,7 @@ namespace TL
/// <param name="hide_via">Whether to hide the <c>via @botname</c> in the resulting message (only for bot usernames encountered in the <see cref="Config"/>)</param>
/// <param name="peer">Destination</param>
/// <param name="reply_to_msg_id">ID of the message this message should reply to</param>
/// <param name="random_id">Random ID to avoid resending the same query</param>
/// <param name="random_id">Random ID to avoid resending the same query <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="query_id">Query ID from <see cref="Messages_GetInlineBotResults">Messages_GetInlineBotResults</see></param>
/// <param name="id">Result ID from <see cref="Messages_GetInlineBotResults">Messages_GetInlineBotResults</see></param>
/// <param name="schedule_date">Scheduled message date for scheduled messages</param>
@ -2376,7 +2424,7 @@ namespace TL
/// <summary>Notify the other user in a private chat that a screenshot of the chat was taken <para>See <a href="https://corefork.telegram.org/method/messages.sendScreenshotNotification"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.sendScreenshotNotification#possible-errors">details</a>)</para></summary>
/// <param name="peer">Other user</param>
/// <param name="reply_to_msg_id">ID of message that was screenshotted, can be 0</param>
/// <param name="random_id">Random ID to avoid message resending</param>
/// <param name="random_id">Random ID to avoid message resending <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
public static Task<UpdatesBase> Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id)
=> client.Invoke(new Messages_SendScreenshotNotification
{
@ -3178,18 +3226,15 @@ namespace TL
/// <summary>Translate a given text <para>See <a href="https://corefork.telegram.org/method/messages.translateText"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.translateText#possible-errors">details</a>)</para></summary>
/// <param name="peer">If the text is a chat message, the peer ID</param>
/// <param name="msg_id">If the text is a chat message, the message ID</param>
/// <param name="text">The text to translate</param>
/// <param name="from_lang">Two-letter ISO 639-1 language code of the language from which the message is translated, if not set will be autodetected</param>
/// <param name="to_lang">Two-letter ISO 639-1 language code of the language to which the message is translated</param>
public static Task<Messages_TranslatedText> Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int? msg_id = null, string text = null, string from_lang = null)
public static Task<Messages_TranslatedText> Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int[] id = null, TextWithEntities[] text = null)
=> client.Invoke(new Messages_TranslateText
{
flags = (Messages_TranslateText.Flags)((peer != null ? 0x1 : 0) | (msg_id != null ? 0x1 : 0) | (text != null ? 0x2 : 0) | (from_lang != null ? 0x4 : 0)),
flags = (Messages_TranslateText.Flags)((peer != null ? 0x1 : 0) | (id != null ? 0x1 : 0) | (text != null ? 0x2 : 0)),
peer = peer,
msg_id = msg_id.GetValueOrDefault(),
id = id,
text = text,
from_lang = from_lang,
to_lang = to_lang,
});
@ -3335,7 +3380,7 @@ namespace TL
/// <summary>Used by the user to relay data from an opened <a href="https://corefork.telegram.org/api/bots/webapps">reply keyboard bot web app</a> to the bot that owns it. <para>See <a href="https://corefork.telegram.org/method/messages.sendWebViewData"/></para></summary>
/// <param name="bot">Bot that owns the web app</param>
/// <param name="random_id">Unique client message ID to prevent duplicate sending of the same event</param>
/// <param name="random_id">Unique client message ID to prevent duplicate sending of the same event <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
/// <param name="button_text">Text of the <see cref="KeyboardButtonSimpleWebView"/> that was pressed to open the web app.</param>
/// <param name="data">Data to relay to the bot, obtained from a <a href="https://corefork.telegram.org/api/web-events#web-app-data-send"><c>web_app_data_send</c> JS event</a>.</param>
public static Task<UpdatesBase> Messages_SendWebViewData(this Client client, InputUserBase bot, long random_id, string button_text, string data)
@ -3457,6 +3502,57 @@ namespace TL
{
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.sendBotRequestedPeer"/></para></summary>
public static Task<UpdatesBase> Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer)
=> client.Invoke(new Messages_SendBotRequestedPeer
{
peer = peer,
msg_id = msg_id,
button_id = button_id,
requested_peer = requested_peer,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.getEmojiGroups"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/messages.emojiGroupsNotModified">messages.emojiGroupsNotModified</a></returns>
public static Task<Messages_EmojiGroups> Messages_GetEmojiGroups(this Client client, int hash = default)
=> client.Invoke(new Messages_GetEmojiGroups
{
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.getEmojiStatusGroups"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/messages.emojiGroupsNotModified">messages.emojiGroupsNotModified</a></returns>
public static Task<Messages_EmojiGroups> Messages_GetEmojiStatusGroups(this Client client, int hash = default)
=> client.Invoke(new Messages_GetEmojiStatusGroups
{
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.getEmojiProfilePhotoGroups"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/messages.emojiGroupsNotModified">messages.emojiGroupsNotModified</a></returns>
public static Task<Messages_EmojiGroups> Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default)
=> client.Invoke(new Messages_GetEmojiProfilePhotoGroups
{
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.searchCustomEmoji"/></para></summary>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/emojiListNotModified">emojiListNotModified</a></returns>
public static Task<EmojiList> Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default)
=> client.Invoke(new Messages_SearchCustomEmoji
{
emoticon = emoticon,
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.togglePeerTranslations"/></para></summary>
public static Task<bool> Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false)
=> client.Invoke(new Messages_TogglePeerTranslations
{
flags = (Messages_TogglePeerTranslations.Flags)(disabled ? 0x1 : 0),
peer = peer,
});
/// <summary>Returns a current state of updates. <para>See <a href="https://corefork.telegram.org/method/updates.getState"/> [bots: ✓]</para></summary>
public static Task<Updates_State> Updates_GetState(this Client client)
=> client.Invoke(new Updates_GetState
@ -3507,13 +3603,14 @@ namespace TL
/// <param name="file">File saved in parts by means of <see cref="Upload_SaveFilePart">Upload_SaveFilePart</see> method</param>
/// <param name="video"><a href="https://corefork.telegram.org/api/files#animated-profile-pictures">Animated profile picture</a> video</param>
/// <param name="video_start_ts">Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview.</param>
public static Task<Photos_Photo> Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool fallback = false)
public static Task<Photos_Photo> Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool fallback = false)
=> client.Invoke(new Photos_UploadProfilePhoto
{
flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (fallback ? 0x8 : 0)),
flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x10 : 0) | (fallback ? 0x8 : 0)),
file = file,
video = video,
video_start_ts = video_start_ts.GetValueOrDefault(),
video_emoji_markup = video_emoji_markup,
});
/// <summary>Deletes profile photos. The method returns a list of successfully deleted photo IDs. <para>See <a href="https://corefork.telegram.org/method/photos.deletePhotos"/></para></summary>
@ -3539,14 +3636,15 @@ namespace TL
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/photos.uploadContactProfilePhoto"/></para></summary>
public static Task<Photos_Photo> Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool suggest = false, bool save = false)
public static Task<Photos_Photo> Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false)
=> client.Invoke(new Photos_UploadContactProfilePhoto
{
flags = (Photos_UploadContactProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (suggest ? 0x8 : 0) | (save ? 0x10 : 0)),
flags = (Photos_UploadContactProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x20 : 0) | (suggest ? 0x8 : 0) | (save ? 0x10 : 0)),
user_id = user_id,
file = file,
video = video,
video_start_ts = video_start_ts.GetValueOrDefault(),
video_emoji_markup = video_emoji_markup,
});
/// <summary>Saves a part of file for further sending to one of the methods. <para>See <a href="https://corefork.telegram.org/method/upload.saveFilePart"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/upload.saveFilePart#possible-errors">details</a>)</para></summary>
@ -3917,10 +4015,10 @@ namespace TL
/// <param name="about">Channel description</param>
/// <param name="geo_point">Geogroup location</param>
/// <param name="address">Geogroup address</param>
public static Task<UpdatesBase> Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false)
public static Task<UpdatesBase> Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false, bool forum = false)
=> client.Invoke(new Channels_CreateChannel
{
flags = (Channels_CreateChannel.Flags)((geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0) | (broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0)),
flags = (Channels_CreateChannel.Flags)((geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0) | (broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (forum ? 0x20 : 0)),
title = title,
about = about,
geo_point = geo_point,
@ -5212,7 +5310,7 @@ namespace TL.Methods
}
[TLDef(0xA677244F)]
public class Auth_SendCode : IMethod<Auth_SentCode>
public class Auth_SendCode : IMethod<Auth_SentCodeBase>
{
public string phone_number;
public int api_id;
@ -5305,7 +5403,7 @@ namespace TL.Methods
}
[TLDef(0x3EF1A9BF)]
public class Auth_ResendCode : IMethod<Auth_SentCode>
public class Auth_ResendCode : IMethod<Auth_SentCodeBase>
{
public string phone_number;
public string phone_code_hash;
@ -5358,6 +5456,22 @@ namespace TL.Methods
public string web_auth_token;
}
[TLDef(0x89464B50)]
public class Auth_RequestFirebaseSms : IMethod<bool>
{
public Flags flags;
public string phone_number;
public string phone_code_hash;
[IfFlag(0)] public string safety_net_token;
[IfFlag(1)] public string ios_push_secret;
[Flags] public enum Flags : uint
{
has_safety_net_token = 0x1,
has_ios_push_secret = 0x2,
}
}
[TLDef(0xEC86017A)]
public class Account_RegisterDevice : IMethod<bool>
{
@ -5482,7 +5596,7 @@ namespace TL.Methods
}
[TLDef(0x82574AE5)]
public class Account_SendChangePhoneCode : IMethod<Auth_SentCode>
public class Account_SendChangePhoneCode : IMethod<Auth_SentCodeBase>
{
public string phone_number;
public CodeSettings settings;
@ -5528,7 +5642,7 @@ namespace TL.Methods
}
[TLDef(0x1B3FAA88)]
public class Account_SendConfirmPhoneCode : IMethod<Auth_SentCode>
public class Account_SendConfirmPhoneCode : IMethod<Auth_SentCodeBase>
{
public string hash;
public CodeSettings settings;
@ -5601,7 +5715,7 @@ namespace TL.Methods
}
[TLDef(0xA5A356F9)]
public class Account_SendVerifyPhoneCode : IMethod<Auth_SentCode>
public class Account_SendVerifyPhoneCode : IMethod<Auth_SentCodeBase>
{
public string phone_number;
public CodeSettings settings;
@ -5954,6 +6068,40 @@ namespace TL.Methods
public bool active;
}
[TLDef(0xE2750328)]
public class Account_GetDefaultProfilePhotoEmojis : IMethod<EmojiList>
{
public long hash;
}
[TLDef(0x915860AE)]
public class Account_GetDefaultGroupPhotoEmojis : IMethod<EmojiList>
{
public long hash;
}
[TLDef(0xADCBBCDA)]
public class Account_GetAutoSaveSettings : IMethod<Account_AutoSaveSettings> { }
[TLDef(0xD69B8361)]
public class Account_SaveAutoSaveSettings : IMethod<bool>
{
public Flags flags;
[IfFlag(3)] public InputPeer peer;
public AutoSaveSettings settings;
[Flags] public enum Flags : uint
{
users = 0x1,
chats = 0x2,
broadcasts = 0x4,
has_peer = 0x8,
}
}
[TLDef(0x53BC0020)]
public class Account_DeleteAutoSaveExceptions : IMethod<bool> { }
[TLDef(0x0D91A548)]
public class Users_GetUsers : IMethod<UserBase[]>
{
@ -7742,21 +7890,19 @@ namespace TL.Methods
public Reaction reaction;
}
[TLDef(0x24CE6DEE)]
[TLDef(0x63183030)]
public class Messages_TranslateText : IMethod<Messages_TranslatedText>
{
public Flags flags;
[IfFlag(0)] public InputPeer peer;
[IfFlag(0)] public int msg_id;
[IfFlag(1)] public string text;
[IfFlag(2)] public string from_lang;
[IfFlag(0)] public int[] id;
[IfFlag(1)] public TextWithEntities[] text;
public string to_lang;
[Flags] public enum Flags : uint
{
has_peer = 0x1,
has_text = 0x2,
has_from_lang = 0x4,
}
}
@ -7977,6 +8123,52 @@ namespace TL.Methods
[TLDef(0x658B7188)]
public class Messages_GetDefaultHistoryTTL : IMethod<DefaultHistoryTTL> { }
[TLDef(0xFE38D01B)]
public class Messages_SendBotRequestedPeer : IMethod<UpdatesBase>
{
public InputPeer peer;
public int msg_id;
public int button_id;
public InputPeer requested_peer;
}
[TLDef(0x7488CE5B)]
public class Messages_GetEmojiGroups : IMethod<Messages_EmojiGroups>
{
public int hash;
}
[TLDef(0x2ECD56CD)]
public class Messages_GetEmojiStatusGroups : IMethod<Messages_EmojiGroups>
{
public int hash;
}
[TLDef(0x21A548F3)]
public class Messages_GetEmojiProfilePhotoGroups : IMethod<Messages_EmojiGroups>
{
public int hash;
}
[TLDef(0x2C11C0D7)]
public class Messages_SearchCustomEmoji : IMethod<EmojiList>
{
public string emoticon;
public long hash;
}
[TLDef(0xE47CB579)]
public class Messages_TogglePeerTranslations : IMethod<bool>
{
public Flags flags;
public InputPeer peer;
[Flags] public enum Flags : uint
{
disabled = 0x1,
}
}
[TLDef(0xEDD4882A)]
public class Updates_GetState : IMethod<Updates_State> { }
@ -8022,13 +8214,14 @@ namespace TL.Methods
}
}
[TLDef(0x89F30F69)]
[TLDef(0x093C9A51)]
public class Photos_UploadProfilePhoto : IMethod<Photos_Photo>
{
public Flags flags;
[IfFlag(0)] public InputFileBase file;
[IfFlag(1)] public InputFileBase video;
[IfFlag(2)] public double video_start_ts;
[IfFlag(4)] public VideoSizeBase video_emoji_markup;
[Flags] public enum Flags : uint
{
@ -8036,6 +8229,7 @@ namespace TL.Methods
has_video = 0x2,
has_video_start_ts = 0x4,
fallback = 0x8,
has_video_emoji_markup = 0x10,
}
}
@ -8054,7 +8248,7 @@ namespace TL.Methods
public int limit;
}
[TLDef(0xB91A83BF)]
[TLDef(0xE14C4A71)]
public class Photos_UploadContactProfilePhoto : IMethod<Photos_Photo>
{
public Flags flags;
@ -8062,6 +8256,7 @@ namespace TL.Methods
[IfFlag(0)] public InputFileBase file;
[IfFlag(1)] public InputFileBase video;
[IfFlag(2)] public double video_start_ts;
[IfFlag(5)] public VideoSizeBase video_emoji_markup;
[Flags] public enum Flags : uint
{
@ -8070,6 +8265,7 @@ namespace TL.Methods
has_video_start_ts = 0x4,
suggest = 0x8,
save = 0x10,
has_video_emoji_markup = 0x20,
}
}
@ -8330,6 +8526,7 @@ namespace TL.Methods
has_geo_point = 0x4,
for_import = 0x8,
has_ttl_period = 0x10,
forum = 0x20,
}
}

View file

@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
public const int Version = 151; // fetched 29/12/2022 21:30:31
public const int Version = 152; // fetched 03/02/2023 21:46:20
internal const int SecretChats = 144;
internal const int MTProto2 = 73;
internal const uint VectorCtor = 0x1CB5C415;
@ -99,7 +99,7 @@ namespace TL
[0x0F94E5F1] = typeof(InputMediaPoll),
[0xE66FBF7B] = typeof(InputMediaDice),
[0x1CA48F57] = null,//InputChatPhotoEmpty
[0xC642724E] = typeof(InputChatUploadedPhoto),
[0xBDCDAEC0] = typeof(InputChatUploadedPhoto),
[0x8953AD37] = typeof(InputChatPhoto),
[0xE4C123D6] = null,//InputGeoPointEmpty
[0x48222FAF] = typeof(InputGeoPoint),
@ -195,6 +195,7 @@ namespace TL
[0xC0944820] = typeof(MessageActionTopicEdit),
[0x57DE635E] = typeof(MessageActionSuggestProfilePhoto),
[0xE7E75F97] = typeof(MessageActionAttachMenuBotAllowed),
[0xFE77345D] = typeof(MessageActionRequestedPeer),
[0xD58A08C6] = typeof(Dialog),
[0x71BD134C] = typeof(DialogFolder),
[0x2331B22D] = typeof(PhotoEmpty),
@ -208,7 +209,8 @@ namespace TL
[0x1117DD5F] = null,//GeoPointEmpty
[0xB2A2F663] = typeof(GeoPoint),
[0x5E002502] = typeof(Auth_SentCode),
[0x33FB7BB8] = typeof(Auth_Authorization),
[0x2390FE44] = typeof(Auth_SentCodeSuccess),
[0x2EA2C0D4] = typeof(Auth_Authorization),
[0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired),
[0xB434E2B8] = typeof(Auth_ExportedAuthorization),
[0xB8BC5B0C] = typeof(InputNotifyPeer),
@ -367,6 +369,7 @@ namespace TL
[0x192EFBE3] = typeof(UpdateChannelPinnedTopic),
[0xFE198602] = typeof(UpdateChannelPinnedTopics),
[0x20529438] = typeof(UpdateUser),
[0xEC05B097] = typeof(UpdateAutoSaveSettings),
[0xA56C2A3E] = typeof(Updates_State),
[0x5D75A138] = typeof(Updates_DifferenceEmpty),
[0x00F49CA0] = typeof(Updates_Difference),
@ -515,6 +518,7 @@ namespace TL
[0x308660C1] = typeof(KeyboardButtonUserProfile),
[0x13767230] = typeof(KeyboardButtonWebView),
[0xA0C0505C] = typeof(KeyboardButtonSimpleWebView),
[0x0D0B468C] = typeof(KeyboardButtonRequestPeer),
[0x77608B83] = typeof(KeyboardButtonRow),
[0xA03E5B85] = typeof(ReplyKeyboardHide),
[0x86B40B08] = typeof(ReplyKeyboardForceReply),
@ -601,6 +605,7 @@ namespace TL
[0x5A159841] = typeof(Auth_SentCodeTypeEmailCode),
[0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired),
[0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms),
[0xE57B1432] = typeof(Auth_SentCodeTypeFirebaseSms),
[0x36585EA4] = typeof(Messages_BotCallbackAnswer),
[0x26B5DDE6] = typeof(Messages_MessageEditData),
[0x890C3D89] = typeof(InputBotInlineMessageID),
@ -868,7 +873,7 @@ namespace TL
[0x967A462E] = typeof(InputWallPaperNoFile),
[0x1C199183] = null,//Account_WallPapersNotModified
[0xCDC3858C] = typeof(Account_WallPapers),
[0x8A6469C2] = typeof(CodeSettings),
[0xAD253D78] = typeof(CodeSettings),
[0x1DC1BCA4] = typeof(WallPaperSettings),
[0x8EFAB953] = typeof(AutoDownloadSettings),
[0x63CACF26] = typeof(Account_AutoDownloadSettings),
@ -922,6 +927,8 @@ namespace TL
[0x98F6AC75] = typeof(Help_PromoDataEmpty),
[0x8C39793F] = typeof(Help_PromoData),
[0xDE33B094] = typeof(VideoSize),
[0xF85C413C] = typeof(VideoSizeEmojiMarkup),
[0x0DA082FE] = typeof(VideoSizeStickerMarkup),
[0x9D04AF9B] = typeof(StatsGroupTopPoster),
[0xD7584C87] = typeof(StatsGroupTopAdmin),
[0x535F779D] = typeof(StatsGroupTopInviter),
@ -987,8 +994,6 @@ namespace TL
[0xC077EC01] = typeof(AvailableReaction),
[0x9F071957] = null,//Messages_AvailableReactionsNotModified
[0x768E3AAD] = typeof(Messages_AvailableReactions),
[0x67CA4737] = typeof(Messages_TranslateNoResult),
[0xA214F7D0] = typeof(Messages_TranslateResultText),
[0xB156FE9C] = typeof(MessagePeerReaction),
[0x80EB48AF] = typeof(GroupCallStreamChannel),
[0xD0E482B2] = typeof(Phone_GroupCallStreamChannels),
@ -1043,7 +1048,7 @@ namespace TL
[0x96D074FD] = typeof(EmailVerificationApple),
[0x2B96CD1B] = typeof(Account_EmailVerified),
[0xE1BB0D61] = typeof(Account_EmailVerifiedLogin),
[0xB6F11EBE] = typeof(PremiumSubscriptionOption),
[0x5F2D1DF2] = typeof(PremiumSubscriptionOption),
[0xB81C7034] = typeof(SendAsPeer),
[0xAD628CC8] = typeof(MessageExtendedMediaPreview),
[0xEE479C64] = typeof(MessageExtendedMedia),
@ -1054,6 +1059,19 @@ namespace TL
[0x367617D3] = typeof(Messages_ForumTopics),
[0x43B46B20] = typeof(DefaultHistoryTTL),
[0x41BF109B] = typeof(ExportedContactToken),
[0x5F3B8A00] = typeof(RequestPeerTypeUser),
[0xC9F06E1B] = typeof(RequestPeerTypeChat),
[0x339BEF6C] = typeof(RequestPeerTypeBroadcast),
[0x481EADFA] = null,//EmojiListNotModified
[0x7A1E11D1] = typeof(EmojiList),
[0x7A9ABDA9] = typeof(EmojiGroup),
[0x6FB4AD87] = null,//Messages_EmojiGroupsNotModified
[0x881FB94B] = typeof(Messages_EmojiGroups),
[0x751F3146] = typeof(TextWithEntities),
[0x33DB32F8] = typeof(Messages_TranslateResult),
[0xC84834CE] = typeof(AutoSaveSettings),
[0x81602D47] = typeof(AutoSaveException),
[0x4C3E069D] = typeof(Account_AutoSaveSettings),
// from TL.Secret:
[0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument),
[0x91CC4674] = typeof(Layer73.DecryptedMessage),
@ -1170,6 +1188,8 @@ namespace TL
[typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone
[typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified
// from TL.Secret:
[typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified
[typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified
[typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty
};
}

View file

@ -13,7 +13,7 @@
<PackageId>WTelegramClient</PackageId>
<Version>0.0.0</Version>
<Authors>Wizou</Authors>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 151&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 152&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Copyright>Copyright © Olivier Marcoux 2021-2023</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/wiz0u/WTelegramClient</PackageProjectUrl>