using System;
using System.Threading.Tasks;
using TL.Methods;
using Client = WTelegram.Client;
namespace TL
{
public static class SchemaExtensions
{
/// Invokes a query after successful completion of one of the previous queries. See
/// Message identifier on which a current query depends
/// The query itself
public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query)
=> client.Invoke(new InvokeAfterMsg
{
msg_id = msg_id,
query = query,
});
/// Invokes a query after a successful completion of previous queries See
/// List of messages on which a current query depends
/// The query itself
public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query)
=> client.Invoke(new InvokeAfterMsgs
{
msg_ids = msg_ids,
query = query,
});
/// Initialize connection See Possible codes: 400 (details)
/// Application identifier (see. App configuration)
/// Device model
/// Operation system version
/// Application version
/// Code for the language used on the device's OS, ISO 639-1 standard
/// Language pack to use
/// Code for the language used on the client, ISO 639-1 standard
/// Info about an MTProto proxy
/// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.
/// The query itself
public static Task InitConnection(this Client client, int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, IMethod query, InputClientProxy proxy = null, JSONValue params_ = null)
=> client.Invoke(new InitConnection
{
flags = (InitConnection.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)),
api_id = api_id,
device_model = device_model,
system_version = system_version,
app_version = app_version,
system_lang_code = system_lang_code,
lang_pack = lang_pack,
lang_code = lang_code,
proxy = proxy,
params_ = params_,
query = query,
});
/// Invoke the specified query using the specified API layer See Possible codes: 400,403,406 (details)
/// The layer to use
/// The query
public static Task InvokeWithLayer(this Client client, int layer, IMethod query)
=> client.Invoke(new InvokeWithLayer
{
layer = layer,
query = query,
});
/// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See
/// The query
public static Task InvokeWithoutUpdates(this Client client, IMethod query)
=> client.Invoke(new InvokeWithoutUpdates
{
query = query,
});
/// Invoke with the given message range See
/// Message range
/// Query
public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query)
=> client.Invoke(new InvokeWithMessagesRange
{
range = range,
query = query,
});
/// Invoke a method within a takeout session, see here » for more info. See
/// Takeout session ID »
/// Query
public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query)
=> client.Invoke(new InvokeWithTakeout
{
takeout_id = takeout_id,
query = query,
});
/// See
public static Task InvokeWithBusinessConnection(this Client client, string connection_id, IMethod query)
=> client.Invoke(new InvokeWithBusinessConnection
{
connection_id = connection_id,
query = query,
});
/// Send the verification code for login See Possible codes: 400,406,500 (details)
/// Phone number in international format
/// Application identifier (see App configuration)
/// Application secret hash (see App configuration)
/// Settings for the code type to send
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task 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,
api_id = api_id,
api_hash = api_hash,
settings = settings,
});
/// Registers a validated phone number in the system. See Possible codes: 400,406 (details)
/// Phone number in the international format
/// SMS-message ID
/// New user first name
/// New user last name
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name, bool no_joined_notifications = false)
=> client.Invoke(new Auth_SignUp
{
flags = (Auth_SignUp.Flags)(no_joined_notifications ? 0x1 : 0),
phone_number = phone_number,
phone_code_hash = phone_code_hash,
first_name = first_name,
last_name = last_name,
});
/// Signs in a user with a validated phone number. See Possible codes: 400,406,500 (details)
/// Phone number in the international format
/// SMS-message ID, obtained from Auth_SendCode
/// Valid numerical code from the SMS-message
/// Email verification code or token
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code = null, EmailVerification email_verification = null)
=> client.Invoke(new Auth_SignIn
{
flags = (Auth_SignIn.Flags)((phone_code != null ? 0x1 : 0) | (email_verification != null ? 0x2 : 0)),
phone_number = phone_number,
phone_code_hash = phone_code_hash,
phone_code = phone_code,
email_verification = email_verification,
});
/// Logs out the user. See [bots: ✓]
public static Task Auth_LogOut(this Client client)
=> client.Invoke(new Auth_LogOut
{
});
/// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details)
public static Task Auth_ResetAuthorizations(this Client client)
=> client.Invoke(new Auth_ResetAuthorizations
{
});
/// Returns data for copying authorization to another data-center. See [bots: ✓] Possible codes: 400 (details)
/// Number of a target data-center
public static Task Auth_ExportAuthorization(this Client client, int dc_id)
=> client.Invoke(new Auth_ExportAuthorization
{
dc_id = dc_id,
});
/// Logs in a user using a key transmitted from his native data-center. See [bots: ✓] Possible codes: 400 (details)
/// User ID
/// Authorization key
public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes)
=> client.Invoke(new Auth_ImportAuthorization
{
id = id,
bytes = bytes,
});
/// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: 400 (details)
/// Permanent auth_key_id to bind to
/// Random long from Binding message contents
/// Unix timestamp to invalidate temporary key, see Binding message contents
/// See Generating encrypted_message
public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message)
=> client.Invoke(new Auth_BindTempAuthKey
{
perm_auth_key_id = perm_auth_key_id,
nonce = nonce,
expires_at = expires_at,
encrypted_message = encrypted_message,
});
/// Login as a bot See [bots: ✓] Possible codes: 400 (details)
/// Reserved for future use
/// Application identifier (see. App configuration)
/// Application identifier hash (see. App configuration)
/// Bot token (see bots)
public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token)
=> client.Invoke(new Auth_ImportBotAuthorization
{
flags = flags,
api_id = api_id,
api_hash = api_hash,
bot_auth_token = bot_auth_token,
});
/// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details)
/// The account's password (see SRP)
public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password)
=> client.Invoke(new Auth_CheckPassword
{
password = password,
});
/// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details)
public static Task Auth_RequestPasswordRecovery(this Client client)
=> client.Invoke(new Auth_RequestPasswordRecovery
{
});
/// Reset the 2FA password using the recovery code sent using Auth_RequestPasswordRecovery. See Possible codes: 400 (details)
/// Code received via email
/// New password
public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null)
=> client.Invoke(new Auth_RecoverPassword
{
flags = (Auth_RecoverPassword.Flags)(new_settings != null ? 0x1 : 0),
code = code,
new_settings = new_settings,
});
/// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See Possible codes: 400,406 (details)
/// The phone number
/// The phone code hash obtained from Auth_SendCode
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash)
=> client.Invoke(new Auth_ResendCode
{
phone_number = phone_number,
phone_code_hash = phone_code_hash,
});
/// Cancel the login verification code See Possible codes: 400,406 (details)
/// Phone number
/// Phone code hash from Auth_SendCode
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")]
public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash)
=> client.Invoke(new Auth_CancelCode
{
phone_number = phone_number,
phone_code_hash = phone_code_hash,
});
/// Delete all temporary authorization keys except for the ones specified See [bots: ✓]
/// The auth keys that shouldn't be dropped.
public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys = null)
=> client.Invoke(new Auth_DropTempAuthKeys
{
except_auth_keys = except_auth_keys,
});
/// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration)
/// Application identifier hash (see. App configuration)
/// List of already logged-in user IDs, to prevent logging in twice with the same user
public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids = null)
=> client.Invoke(new Auth_ExportLoginToken
{
api_id = api_id,
api_hash = api_hash,
except_ids = except_ids,
});
/// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details)
/// Login token
public static Task Auth_ImportLoginToken(this Client client, byte[] token)
=> client.Invoke(new Auth_ImportLoginToken
{
token = token,
});
/// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details)
/// Login token embedded in QR code, for more info, see login via QR code.
public static Task Auth_AcceptLoginToken(this Client client, byte[] token)
=> client.Invoke(new Auth_AcceptLoginToken
{
token = token,
});
/// Check if the 2FA recovery code sent using Auth_RequestPasswordRecovery is valid, before passing it to Auth_RecoverPassword. See Possible codes: 400 (details)
/// Code received via email
public static Task Auth_CheckRecoveryPassword(this Client client, string code)
=> client.Invoke(new Auth_CheckRecoveryPassword
{
code = code,
});
/// Login by importing an authorization token See Possible codes: 400 (details)
/// API ID
/// API hash
/// The authorization token
public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token)
=> client.Invoke(new Auth_ImportWebTokenAuthorization
{
api_id = api_id,
api_hash = api_hash,
web_auth_token = web_auth_token,
});
/// Request an SMS code via Firebase. See Possible codes: 400 (details)
/// Phone number
/// Phone code hash returned by Auth_SendCode
/// On Android, a JWS object obtained as described in the auth documentation »
/// Secret token received via an apple push notification
public static Task 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,
});
/// Reset the login email ». See Possible codes: 400 (details)
/// Phone number of the account
/// Phone code hash, obtained as described in the documentation »
public static Task Auth_ResetLoginEmail(this Client client, string phone_number, string phone_code_hash)
=> client.Invoke(new Auth_ResetLoginEmail
{
phone_number = phone_number,
phone_code_hash = phone_code_hash,
});
/// Register device to receive PUSH notifications See Possible codes: 400 (details)
/// Avoid receiving (silent and invisible background) notifications. Useful to save battery.
/// Device token type, see PUSH updates for the possible values.
/// Device token, see PUSH updates for the possible values.
/// If is transmitted, a sandbox-certificate will be used during transmission.
/// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications
/// List of user identifiers of other users currently using the client
public static Task Account_RegisterDevice(this Client client, int token_type, string token, bool app_sandbox, byte[] secret, long[] other_uids, bool no_muted = false)
=> client.Invoke(new Account_RegisterDevice
{
flags = (Account_RegisterDevice.Flags)(no_muted ? 0x1 : 0),
token_type = token_type,
token = token,
app_sandbox = app_sandbox,
secret = secret,
other_uids = other_uids,
});
/// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details)
/// Device token type, see PUSH updates for the possible values.
/// Device token, see PUSH updates for the possible values.
/// List of user identifiers of other users currently using the client
public static Task Account_UnregisterDevice(this Client client, int token_type, string token, params long[] other_uids)
=> client.Invoke(new Account_UnregisterDevice
{
token_type = token_type,
token = token,
other_uids = other_uids,
});
/// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details)
/// Notification source
/// Notification settings
public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings)
=> client.Invoke(new Account_UpdateNotifySettings
{
peer = peer,
settings = settings,
});
/// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details)
/// Notification source
public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer)
=> client.Invoke(new Account_GetNotifySettings
{
peer = peer,
});
/// Resets all notification settings from users and groups. See
public static Task Account_ResetNotifySettings(this Client client)
=> client.Invoke(new Account_ResetNotifySettings
{
});
/// Updates user profile. See Possible codes: 400 (details)
/// New user first name
/// New user last name
/// New bio
public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null)
=> client.Invoke(new Account_UpdateProfile
{
flags = (Account_UpdateProfile.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)),
first_name = first_name,
last_name = last_name,
about = about,
});
/// Updates online user status. See
/// If is transmitted, user status will change to .
public static Task Account_UpdateStatus(this Client client, bool offline)
=> client.Invoke(new Account_UpdateStatus
{
offline = offline,
});
/// Returns a list of available wallpapers. See
/// Hash for pagination, for more info click here
/// a null value means account.wallPapersNotModified
public static Task Account_GetWallPapers(this Client client, long hash = default)
=> client.Invoke(new Account_GetWallPapers
{
hash = hash,
});
/// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details)
/// The peer to report
/// The reason why this peer is being reported
/// Comment for report moderation
public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message)
=> client.Invoke(new Account_ReportPeer
{
peer = peer,
reason = reason,
message = message,
});
/// Validates a username and checks availability. See Possible codes: 400 (details)
/// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
public static Task Account_CheckUsername(this Client client, string username)
=> client.Invoke(new Account_CheckUsername
{
username = username,
});
/// Changes username for the current user. See Possible codes: 400 (details)
/// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
public static Task Account_UpdateUsername(this Client client, string username)
=> client.Invoke(new Account_UpdateUsername
{
username = username,
});
/// Get privacy settings of current account See Possible codes: 400 (details)
/// Peer category whose privacy settings should be fetched
public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key)
=> client.Invoke(new Account_GetPrivacy
{
key = key,
});
/// Change privacy settings of current account See Possible codes: 400 (details)
/// New privacy rule
/// Peers to which the privacy rule will apply.
public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, params InputPrivacyRule[] rules)
=> client.Invoke(new Account_SetPrivacy
{
key = key,
rules = rules,
});
/// Delete the user's account from the telegram servers. See Possible codes: 420 (details)
/// Why is the account being deleted, can be empty
/// 2FA password: this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days as specified in the docs »
public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null)
=> client.Invoke(new Account_DeleteAccount
{
flags = (Account_DeleteAccount.Flags)(password != null ? 0x1 : 0),
reason = reason,
password = password,
});
/// Get days to live of account See
public static Task Account_GetAccountTTL(this Client client)
=> client.Invoke(new Account_GetAccountTTL
{
});
/// Set account self-destruction period See Possible codes: 400 (details)
/// Time to live in days
public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl)
=> client.Invoke(new Account_SetAccountTTL
{
ttl = ttl,
});
/// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details)
/// New phone number
/// Phone code settings
public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings)
=> client.Invoke(new Account_SendChangePhoneCode
{
phone_number = phone_number,
settings = settings,
});
/// Change the phone number of the current account See Possible codes: 400,406 (details)
/// New phone number
/// Phone code hash received when calling Account_SendChangePhoneCode
/// Phone code received when calling Account_SendChangePhoneCode
public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code)
=> client.Invoke(new Account_ChangePhone
{
phone_number = phone_number,
phone_code_hash = phone_code_hash,
phone_code = phone_code,
});
/// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See
/// Inactivity period after which to start hiding message texts in PUSH notifications.
public static Task Account_UpdateDeviceLocked(this Client client, int period)
=> client.Invoke(new Account_UpdateDeviceLocked
{
period = period,
});
/// Get logged-in sessions See
public static Task Account_GetAuthorizations(this Client client)
=> client.Invoke(new Account_GetAuthorizations
{
});
/// Log out an active authorized session by its hash See Possible codes: 400,406 (details)
/// Session hash
public static Task Account_ResetAuthorization(this Client client, long hash)
=> client.Invoke(new Account_ResetAuthorization
{
hash = hash,
});
/// Obtain configuration for two-factor authorization with password See
public static Task Account_GetPassword(this Client client)
=> client.Invoke(new Account_GetPassword
{
});
/// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details)
/// The password (see SRP)
public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password)
=> client.Invoke(new Account_GetPasswordSettings
{
password = password,
});
/// Set a new 2FA password See Possible codes: 400 (details)
/// The old password (see SRP)
/// The new password (see SRP)
public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings)
=> client.Invoke(new Account_UpdatePasswordSettings
{
password = password,
new_settings = new_settings,
});
/// Send confirmation code to cancel account deletion, for more info click here » See Possible codes: 400 (details)
/// The hash from the service notification, for more info click here »
/// Phone code settings
public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings)
=> client.Invoke(new Account_SendConfirmPhoneCode
{
hash = hash,
settings = settings,
});
/// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details)
/// Phone code hash, for more info click here »
/// SMS code, for more info click here »
public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code)
=> client.Invoke(new Account_ConfirmPhone
{
phone_code_hash = phone_code_hash,
phone_code = phone_code,
});
/// Get temporary payment password See Possible codes: 400 (details)
/// SRP password parameters
/// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400
public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period)
=> client.Invoke(new Account_GetTmpPassword
{
password = password,
period = period,
});
/// Get web login widget authorizations See
public static Task Account_GetWebAuthorizations(this Client client)
=> client.Invoke(new Account_GetWebAuthorizations
{
});
/// Log out an active web telegram login session See Possible codes: 400 (details)
/// Session hash
public static Task Account_ResetWebAuthorization(this Client client, long hash)
=> client.Invoke(new Account_ResetWebAuthorization
{
hash = hash,
});
/// Reset all active web telegram login sessions See
public static Task Account_ResetWebAuthorizations(this Client client)
=> client.Invoke(new Account_ResetWebAuthorizations
{
});
/// Get all saved Telegram Passport documents, for more info see the passport docs » See
public static Task Account_GetAllSecureValues(this Client client)
=> client.Invoke(new Account_GetAllSecureValues
{
});
/// Get saved Telegram Passport document, for more info see the passport docs » See
/// Requested value types
public static Task Account_GetSecureValue(this Client client, params SecureValueType[] types)
=> client.Invoke(new Account_GetSecureValue
{
types = types,
});
/// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details)
/// Secure value, for more info see the passport docs »
/// Passport secret hash, for more info see the passport docs »
public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id)
=> client.Invoke(new Account_SaveSecureValue
{
value = value,
secure_secret_id = secure_secret_id,
});
/// Delete stored Telegram Passport documents, for more info see the passport docs » See
/// Document types to delete
public static Task Account_DeleteSecureValue(this Client client, params SecureValueType[] types)
=> client.Invoke(new Account_DeleteSecureValue
{
types = types,
});
/// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details)
/// User identifier of the service's bot
/// Telegram Passport element types requested by the service
/// Service's public key
public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key)
=> client.Invoke(new Account_GetAuthorizationForm
{
bot_id = bot_id,
scope = scope,
public_key = public_key,
});
/// Sends a Telegram Passport authorization form, effectively sharing data with the service See Possible codes: 400 (details)
/// Bot ID
/// Telegram Passport element types requested by the service
/// Service's public key
/// Types of values sent and their hashes
/// Encrypted values
public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials)
=> client.Invoke(new Account_AcceptAuthorization
{
bot_id = bot_id,
scope = scope,
public_key = public_key,
value_hashes = value_hashes,
credentials = credentials,
});
/// Send the verification phone code for telegram passport. See Possible codes: 400 (details)
/// The phone number to verify
/// Phone code settings
public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings)
=> client.Invoke(new Account_SendVerifyPhoneCode
{
phone_number = phone_number,
settings = settings,
});
/// Verify a phone number for telegram passport. See Possible codes: 400 (details)
/// Phone number
/// Phone code hash received from the call to Account_SendVerifyPhoneCode
/// Code received after the call to Account_SendVerifyPhoneCode
public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code)
=> client.Invoke(new Account_VerifyPhone
{
phone_number = phone_number,
phone_code_hash = phone_code_hash,
phone_code = phone_code,
});
/// Send an email verification code. See Possible codes: 400 (details)
/// Verification purpose.
/// The email where to send the code.
public static Task Account_SendVerifyEmailCode(this Client client, EmailVerifyPurpose purpose, string email)
=> client.Invoke(new Account_SendVerifyEmailCode
{
purpose = purpose,
email = email,
});
/// Verify an email address. See Possible codes: 400 (details)
/// Verification purpose
/// Email verification code or token
public static Task Account_VerifyEmail(this Client client, EmailVerifyPurpose purpose, EmailVerification verification)
=> client.Invoke(new Account_VerifyEmail
{
purpose = purpose,
verification = verification,
});
/// Initialize a takeout session, see here » for more info. See Possible codes: 420 (details)
/// Whether to export contacts
/// Whether to export messages in private chats
/// Whether to export messages in basic groups
/// Whether to export messages in supergroups
/// Whether to export messages in channels
/// Whether to export files
/// Maximum size of files to export
public static Task Account_InitTakeoutSession(this Client client, long? file_max_size = null, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false)
=> client.Invoke(new Account_InitTakeoutSession
{
flags = (Account_InitTakeoutSession.Flags)((file_max_size != null ? 0x20 : 0) | (contacts ? 0x1 : 0) | (message_users ? 0x2 : 0) | (message_chats ? 0x4 : 0) | (message_megagroups ? 0x8 : 0) | (message_channels ? 0x10 : 0) | (files ? 0x20 : 0)),
file_max_size = file_max_size.GetValueOrDefault(),
});
/// Terminate a takeout session, see here » for more info. See Possible codes: 403 (details)
/// Data exported successfully
public static Task Account_FinishTakeoutSession(this Client client, bool success = false)
=> client.Invoke(new Account_FinishTakeoutSession
{
flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0),
});
/// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details)
/// The phone code that was received after setting a recovery email
public static Task Account_ConfirmPasswordEmail(this Client client, string code)
=> client.Invoke(new Account_ConfirmPasswordEmail
{
code = code,
});
/// Resend the code to verify an email to use as 2FA recovery method. See Possible codes: 400 (details)
public static Task Account_ResendPasswordEmail(this Client client)
=> client.Invoke(new Account_ResendPasswordEmail
{
});
/// Cancel the code that was sent to verify an email to use as 2FA recovery method. See Possible codes: 400 (details)
public static Task Account_CancelPasswordEmail(this Client client)
=> client.Invoke(new Account_CancelPasswordEmail
{
});
/// Whether the user will receive notifications when contacts sign up See
public static Task Account_GetContactSignUpNotification(this Client client)
=> client.Invoke(new Account_GetContactSignUpNotification
{
});
/// Toggle contact sign up notifications See
/// Whether to disable contact sign up notifications
public static Task Account_SetContactSignUpNotification(this Client client, bool silent)
=> client.Invoke(new Account_SetContactSignUpNotification
{
silent = silent,
});
/// Returns list of chats with non-default notification settings See
/// If set, chats with non-default sound will be returned
/// If set, chats with non-default notification settings for stories will be returned
/// If specified, only chats of the specified category will be returned
public static Task Account_GetNotifyExceptions(this Client client, InputNotifyPeerBase peer = null, bool compare_sound = false, bool compare_stories = false)
=> client.Invoke(new Account_GetNotifyExceptions
{
flags = (Account_GetNotifyExceptions.Flags)((peer != null ? 0x1 : 0) | (compare_sound ? 0x2 : 0) | (compare_stories ? 0x4 : 0)),
peer = peer,
});
/// Get info about a certain wallpaper See Possible codes: 400 (details)
/// The wallpaper to get info about
public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper)
=> client.Invoke(new Account_GetWallPaper
{
wallpaper = wallpaper,
});
/// Create and upload a new wallpaper See Possible codes: 400 (details)
/// Set this flag when uploading wallpapers to be passed to Messages_SetChatWallPaper.
/// The JPG/PNG wallpaper
/// MIME type of uploaded wallpaper
/// Wallpaper settings
public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings, bool for_chat = false)
=> client.Invoke(new Account_UploadWallPaper
{
flags = (Account_UploadWallPaper.Flags)(for_chat ? 0x1 : 0),
file = file,
mime_type = mime_type,
settings = settings,
});
/// Install/uninstall wallpaper See Possible codes: 400 (details)
/// Wallpaper to install or uninstall
/// Uninstall wallpaper?
/// Wallpaper settings
public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings)
=> client.Invoke(new Account_SaveWallPaper
{
wallpaper = wallpaper,
unsave = unsave,
settings = settings,
});
/// Install wallpaper See Possible codes: 400 (details)
/// Wallpaper to install
/// Wallpaper settings
public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings)
=> client.Invoke(new Account_InstallWallPaper
{
wallpaper = wallpaper,
settings = settings,
});
/// Delete all installed wallpapers, reverting to the default wallpaper set. See
public static Task Account_ResetWallPapers(this Client client)
=> client.Invoke(new Account_ResetWallPapers
{
});
/// Get media autodownload settings See
public static Task Account_GetAutoDownloadSettings(this Client client)
=> client.Invoke(new Account_GetAutoDownloadSettings
{
});
/// Change media autodownload settings See
/// Whether to save media in the low data usage preset
/// Whether to save media in the high data usage preset
/// Media autodownload settings
public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false)
=> client.Invoke(new Account_SaveAutoDownloadSettings
{
flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)),
settings = settings,
});
/// Upload theme See Possible codes: 400 (details)
/// Previously uploaded theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors.
/// Thumbnail
/// File name
/// MIME type, must be application/x-tgtheme-{format}, where format depends on the client
public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null)
=> client.Invoke(new Account_UploadTheme
{
flags = (Account_UploadTheme.Flags)(thumb != null ? 0x1 : 0),
file = file,
thumb = thumb,
file_name = file_name,
mime_type = mime_type,
});
/// Create a theme See Possible codes: 400 (details)
/// Unique theme ID used to generate theme deep links, can be empty to autogenerate a random ID.
/// Theme name
/// Theme file
/// Theme settings, multiple values can be provided for the different base themes (day/night mode, etc).
public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null)
=> client.Invoke(new Account_CreateTheme
{
flags = (Account_CreateTheme.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)),
slug = slug,
title = title,
document = document,
settings = settings,
});
/// Update theme See Possible codes: 400 (details)
/// Theme format, a string that identifies the theming engines supported by the client
/// Theme to update
/// Unique theme ID
/// Theme name
/// Theme file
/// Theme settings
public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null)
=> client.Invoke(new Account_UpdateTheme
{
flags = (Account_UpdateTheme.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)),
format = format,
theme = theme,
slug = slug,
title = title,
document = document,
settings = settings,
});
/// Save a theme See
/// Theme to save
/// Unsave
public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave)
=> client.Invoke(new Account_SaveTheme
{
theme = theme,
unsave = unsave,
});
/// Install a theme See
/// Whether to install the dark version
/// Theme to install
/// Theme format, a string that identifies the theming engines supported by the client
/// Indicates a basic theme provided by all clients
public static Task Account_InstallTheme(this Client client, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default, bool dark = false)
=> client.Invoke(new Account_InstallTheme
{
flags = (Account_InstallTheme.Flags)((theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0) | (dark ? 0x1 : 0)),
theme = theme,
format = format,
base_theme = base_theme,
});
/// Get theme information See Possible codes: 400 (details)
/// Theme format, a string that identifies the theming engines supported by the client
/// Theme
public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme)
=> client.Invoke(new Account_GetTheme
{
format = format,
theme = theme,
});
/// Get installed themes See
/// Theme format, a string that identifies the theming engines supported by the client
/// Hash for pagination, for more info click here
/// a null value means account.themesNotModified
public static Task Account_GetThemes(this Client client, string format, long hash = default)
=> client.Invoke(new Account_GetThemes
{
format = format,
hash = hash,
});
/// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details)
/// Enable NSFW content
public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false)
=> client.Invoke(new Account_SetContentSettings
{
flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0),
});
/// Get sensitive content settings See
public static Task Account_GetContentSettings(this Client client)
=> client.Invoke(new Account_GetContentSettings
{
});
/// Get info about multiple wallpapers See Possible codes: 400 (details)
/// Wallpapers to fetch info about
public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers)
=> client.Invoke(new Account_GetMultiWallPapers
{
wallpapers = wallpapers,
});
/// Get global privacy settings See
public static Task Account_GetGlobalPrivacySettings(this Client client)
=> client.Invoke(new Account_GetGlobalPrivacySettings
{
});
/// Set global privacy settings See Possible codes: 400 (details)
/// Global privacy settings
public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings)
=> client.Invoke(new Account_SetGlobalPrivacySettings
{
settings = settings,
});
/// Report a profile photo of a dialog See Possible codes: 400 (details)
/// The dialog
/// Dialog photo ID
/// Report reason
/// Comment for report moderation
public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message)
=> client.Invoke(new Account_ReportProfilePhoto
{
peer = peer,
photo_id = photo_id,
reason = reason,
message = message,
});
/// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See Possible codes: 400 (details)
public static Task Account_ResetPassword(this Client client)
=> client.Invoke(new Account_ResetPassword
{
});
/// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details)
public static Task Account_DeclinePasswordReset(this Client client)
=> client.Invoke(new Account_DeclinePasswordReset
{
});
/// Get all available chat themes ». See
/// Hash for pagination, for more info click here
/// a null value means account.themesNotModified
public static Task Account_GetChatThemes(this Client client, long hash = default)
=> client.Invoke(new Account_GetChatThemes
{
hash = hash,
});
/// Set time-to-live of current session See Possible codes: 400,406 (details)
/// Time-to-live of current session in days
public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days)
=> client.Invoke(new Account_SetAuthorizationTTL
{
authorization_ttl_days = authorization_ttl_days,
});
/// Change settings related to a session. See Possible codes: 400 (details)
/// If set, confirms a newly logged in session ».
/// Session ID from the , fetchable using Account_GetAuthorizations
/// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed
/// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed
public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default, bool confirmed = false)
=> client.Invoke(new Account_ChangeAuthorizationSettings
{
flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0) | (confirmed ? 0x8 : 0)),
hash = hash,
encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(),
call_requests_disabled = call_requests_disabled.GetValueOrDefault(),
});
/// Fetch saved notification sounds See
/// Hash for pagination, for more info click here
/// a null value means account.savedRingtonesNotModified
public static Task Account_GetSavedRingtones(this Client client, long hash = default)
=> client.Invoke(new Account_GetSavedRingtones
{
hash = hash,
});
/// Save or remove saved notification sound. See
/// Notification sound uploaded using Account_UploadRingtone
/// Whether to add or delete the notification sound
public static Task Account_SaveRingtone(this Client client, InputDocument id, bool unsave)
=> client.Invoke(new Account_SaveRingtone
{
id = id,
unsave = unsave,
});
/// Upload notification sound, use Account_SaveRingtone to convert it and add it to the list of saved notification sounds. See
/// Notification sound
/// File name
/// MIME type of file
public static Task Account_UploadRingtone(this Client client, InputFileBase file, string file_name, string mime_type)
=> client.Invoke(new Account_UploadRingtone
{
file = file,
file_name = file_name,
mime_type = mime_type,
});
/// Set an emoji status See Possible codes: 400 (details)
/// Emoji status to set
public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status)
=> client.Invoke(new Account_UpdateEmojiStatus
{
emoji_status = emoji_status,
});
/// Get a list of default suggested emoji statuses See
/// Hash for pagination, for more info click here
/// a null value means account.emojiStatusesNotModified
public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultEmojiStatuses
{
hash = hash,
});
/// Get recently used emoji statuses See
/// Hash for pagination, for more info click here
/// a null value means account.emojiStatusesNotModified
public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default)
=> client.Invoke(new Account_GetRecentEmojiStatuses
{
hash = hash,
});
/// Clears list of recently used emoji statuses See
public static Task Account_ClearRecentEmojiStatuses(this Client client)
=> client.Invoke(new Account_ClearRecentEmojiStatuses
{
});
/// Reorder usernames associated with the currently logged-in user. See Possible codes: 400 (details)
/// The new order for active usernames. All active usernames must be specified.
public static Task Account_ReorderUsernames(this Client client, params string[] order)
=> client.Invoke(new Account_ReorderUsernames
{
order = order,
});
/// Activate or deactivate a purchased fragment.com username associated to the currently logged-in user. See Possible codes: 400 (details)
/// Username
/// Whether to activate or deactivate it
public static Task Account_ToggleUsername(this Client client, string username, bool active)
=> client.Invoke(new Account_ToggleUsername
{
username = username,
active = active,
});
/// Get a set of suggested custom emoji stickers that can be used as profile picture See
/// Hash for pagination, for more info click here
/// a null value means emojiListNotModified
public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultProfilePhotoEmojis
{
hash = hash,
});
/// Get a set of suggested custom emoji stickers that can be used as group picture See
/// Hash for pagination, for more info click here
/// a null value means emojiListNotModified
public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultGroupPhotoEmojis
{
hash = hash,
});
/// Get autosave settings See
public static Task Account_GetAutoSaveSettings(this Client client)
=> client.Invoke(new Account_GetAutoSaveSettings
{
});
/// Modify autosave settings See [bots: ✓] Possible codes: 400 (details)
/// Whether the new settings should affect all private chats
/// Whether the new settings should affect all groups
/// Whether the new settings should affect all channels
/// Whether the new settings should affect a specific peer
/// The new autosave settings
public static Task 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,
});
/// Clear all peer-specific autosave settings. See
public static Task Account_DeleteAutoSaveExceptions(this Client client)
=> client.Invoke(new Account_DeleteAutoSaveExceptions
{
});
/// Invalidate the specified login codes, see here » for more info. See
/// The login codes to invalidate.
public static Task Account_InvalidateSignInCodes(this Client client, params string[] codes)
=> client.Invoke(new Account_InvalidateSignInCodes
{
codes = codes,
});
/// Update the accent color and background custom emoji » of the current account. See Possible codes: 400 (details)
/// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed.
/// ID of the accent color palette » to use (not RGB24, see here » for more info).
/// Custom emoji ID used in the accent color pattern.
public static Task Account_UpdateColor(this Client client, long? background_emoji_id = null, int? color = null, bool for_profile = false)
=> client.Invoke(new Account_UpdateColor
{
flags = (Account_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)),
color = color.GetValueOrDefault(),
background_emoji_id = background_emoji_id.GetValueOrDefault(),
});
/// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See
/// Hash for pagination, for more info click here
/// a null value means emojiListNotModified
public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetDefaultBackgroundEmojis
{
hash = hash,
});
/// Get a list of default suggested channel emoji statuses. See
/// Hash for pagination, for more info click here
/// a null value means account.emojiStatusesNotModified
public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default)
=> client.Invoke(new Account_GetChannelDefaultEmojiStatuses
{
hash = hash,
});
/// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See
/// Hash for pagination, for more info click here
/// a null value means emojiListNotModified
public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default)
=> client.Invoke(new Account_GetChannelRestrictedStatusEmojis
{
hash = hash,
});
/// See
public static Task Account_UpdateBusinessWorkHours(this Client client, BusinessWorkHours business_work_hours = null)
=> client.Invoke(new Account_UpdateBusinessWorkHours
{
flags = (Account_UpdateBusinessWorkHours.Flags)(business_work_hours != null ? 0x1 : 0),
business_work_hours = business_work_hours,
});
/// See
public static Task Account_UpdateBusinessLocation(this Client client, string address = null, InputGeoPoint geo_point = null)
=> client.Invoke(new Account_UpdateBusinessLocation
{
flags = (Account_UpdateBusinessLocation.Flags)((address != null ? 0x1 : 0) | (geo_point != null ? 0x2 : 0)),
geo_point = geo_point,
address = address,
});
/// See
public static Task Account_UpdateBusinessGreetingMessage(this Client client, InputBusinessGreetingMessage message = null)
=> client.Invoke(new Account_UpdateBusinessGreetingMessage
{
flags = (Account_UpdateBusinessGreetingMessage.Flags)(message != null ? 0x1 : 0),
message = message,
});
/// See
public static Task Account_UpdateBusinessAwayMessage(this Client client, InputBusinessAwayMessage message = null)
=> client.Invoke(new Account_UpdateBusinessAwayMessage
{
flags = (Account_UpdateBusinessAwayMessage.Flags)(message != null ? 0x1 : 0),
message = message,
});
/// See
public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, bool can_reply = false, bool deleted = false)
=> client.Invoke(new Account_UpdateConnectedBot
{
flags = (Account_UpdateConnectedBot.Flags)((can_reply ? 0x1 : 0) | (deleted ? 0x2 : 0)),
bot = bot,
recipients = recipients,
});
/// See
public static Task Account_GetConnectedBots(this Client client)
=> client.Invoke(new Account_GetConnectedBots
{
});
/// See
public static Task Account_GetBotBusinessConnection(this Client client, string connection_id)
=> client.Invoke(new Account_GetBotBusinessConnection
{
connection_id = connection_id,
});
/// See
public static Task Account_UpdateBusinessIntro(this Client client, InputBusinessIntro intro = null)
=> client.Invoke(new Account_UpdateBusinessIntro
{
flags = (Account_UpdateBusinessIntro.Flags)(intro != null ? 0x1 : 0),
intro = intro,
});
/// See
public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused)
=> client.Invoke(new Account_ToggleConnectedBotPaused
{
peer = peer,
paused = paused,
});
/// See
public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer)
=> client.Invoke(new Account_DisablePeerConnectedBot
{
peer = peer,
});
/// See
public static Task Account_UpdateBirthday(this Client client, Birthday birthday = null)
=> client.Invoke(new Account_UpdateBirthday
{
flags = (Account_UpdateBirthday.Flags)(birthday != null ? 0x1 : 0),
birthday = birthday,
});
/// See
public static Task Account_CreateBusinessChatLink(this Client client, InputBusinessChatLink link)
=> client.Invoke(new Account_CreateBusinessChatLink
{
link = link,
});
/// See
public static Task Account_EditBusinessChatLink(this Client client, string slug, InputBusinessChatLink link)
=> client.Invoke(new Account_EditBusinessChatLink
{
slug = slug,
link = link,
});
/// See
public static Task Account_DeleteBusinessChatLink(this Client client, string slug)
=> client.Invoke(new Account_DeleteBusinessChatLink
{
slug = slug,
});
/// See
public static Task Account_GetBusinessChatLinks(this Client client)
=> client.Invoke(new Account_GetBusinessChatLinks
{
});
/// See
public static Task Account_ResolveBusinessChatLink(this Client client, string slug)
=> client.Invoke(new Account_ResolveBusinessChatLink
{
slug = slug,
});
/// See
public static Task Account_UpdatePersonalChannel(this Client client, InputChannelBase channel)
=> client.Invoke(new Account_UpdatePersonalChannel
{
channel = channel,
});
/// See
public static Task Account_ToggleSponsoredMessages(this Client client, bool enabled)
=> client.Invoke(new Account_ToggleSponsoredMessages
{
enabled = enabled,
});
/// See
public static Task Account_GetReactionsNotifySettings(this Client client)
=> client.Invoke(new Account_GetReactionsNotifySettings
{
});
/// See
public static Task Account_SetReactionsNotifySettings(this Client client, ReactionsNotifySettings settings)
=> client.Invoke(new Account_SetReactionsNotifySettings
{
settings = settings,
});
/// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details)
/// List of user identifiers
public static Task Users_GetUsers(this Client client, params InputUserBase[] id)
=> client.Invoke(new Users_GetUsers
{
id = id,
});
/// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details)
/// User ID
public static Task Users_GetFullUser(this Client client, InputUserBase id)
=> client.Invoke(new Users_GetFullUser
{
id = id,
});
/// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓] Possible codes: 400,403 (details)
/// The user
/// Errors
public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors)
=> client.Invoke(new Users_SetSecureValueErrors
{
id = id,
errors = errors,
});
/// See
public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id)
=> client.Invoke(new Users_GetIsPremiumRequiredToContact
{
id = id,
});
/// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash for pagination, for more info click here
public static Task Contacts_GetContactIDs(this Client client, long hash = default)
=> client.Invoke(new Contacts_GetContactIDs
{
hash = hash,
});
/// Use this method to obtain the online statuses of all contacts with an accessible Telegram account. See
public static Task Contacts_GetStatuses(this Client client)
=> client.Invoke(new Contacts_GetStatuses
{
});
/// Returns the current user's contact list. See
/// If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, will be returned.
/// a null value means contacts.contactsNotModified
public static Task Contacts_GetContacts(this Client client, long hash = default)
=> client.Invoke(new Contacts_GetContacts
{
hash = hash,
});
/// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See
/// List of contacts to import
public static Task Contacts_ImportContacts(this Client client, params InputContact[] contacts)
=> client.Invoke(new Contacts_ImportContacts
{
contacts = contacts,
});
/// Deletes several contacts from the list. See
/// User ID list
public static Task Contacts_DeleteContacts(this Client client, params InputUserBase[] id)
=> client.Invoke(new Contacts_DeleteContacts
{
id = id,
});
/// Delete contacts by phone number See
/// Phone numbers
public static Task Contacts_DeleteByPhones(this Client client, params string[] phones)
=> client.Invoke(new Contacts_DeleteByPhones
{
phones = phones,
});
/// Adds a peer to a blocklist, see here » for more info. See Possible codes: 400 (details)
/// Whether the peer should be added to the story blocklist; if not set, the peer will be added to the main blocklist, see here » for more info.
/// Peer
public static Task Contacts_Block(this Client client, InputPeer id, bool my_stories_from = false)
=> client.Invoke(new Contacts_Block
{
flags = (Contacts_Block.Flags)(my_stories_from ? 0x1 : 0),
id = id,
});
/// Deletes a peer from a blocklist, see here » for more info. See Possible codes: 400 (details)
/// Whether the peer should be removed from the story blocklist; if not set, the peer will be removed from the main blocklist, see here » for more info.
/// Peer
public static Task Contacts_Unblock(this Client client, InputPeer id, bool my_stories_from = false)
=> client.Invoke(new Contacts_Unblock
{
flags = (Contacts_Unblock.Flags)(my_stories_from ? 0x1 : 0),
id = id,
});
/// Returns the list of blocked users. See
/// Whether to fetch the story blocklist; if not set, will fetch the main blocklist. See here » for differences between the two.
/// The number of list elements to be skipped
/// The number of list elements to be returned
public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue, bool my_stories_from = false)
=> client.Invoke(new Contacts_GetBlocked
{
flags = (Contacts_GetBlocked.Flags)(my_stories_from ? 0x1 : 0),
offset = offset,
limit = limit,
});
/// Returns users found by username substring. See Possible codes: 400 (details)
/// Target substring
/// Maximum number of users to be returned
public static Task Contacts_Search(this Client client, string q, int limit = int.MaxValue)
=> client.Invoke(new Contacts_Search
{
q = q,
limit = limit,
});
/// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details)
/// @username to resolve
public static Task Contacts_ResolveUsername(this Client client, string username)
=> client.Invoke(new Contacts_ResolveUsername
{
username = username,
});
/// Get most used peers See Possible codes: 400 (details)
/// Users we've chatted most frequently with
/// Most used bots
/// Most used inline bots
/// Most frequently called users
/// Users to which the users often forwards messages to
/// Chats to which the users often forwards messages to
/// Often-opened groups and supergroups
/// Most frequently visited channels
/// Offset for pagination
/// Maximum number of results to return, see pagination
/// Hash for pagination, for more info click here
/// a null value means contacts.topPeersNotModified
public static Task Contacts_GetTopPeers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false)
=> client.Invoke(new Contacts_GetTopPeers
{
flags = (Contacts_GetTopPeers.Flags)((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0)),
offset = offset,
limit = limit,
hash = hash,
});
/// Reset rating of top peer See Possible codes: 400 (details)
/// Top peer category
/// Peer whose rating should be reset
public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer)
=> client.Invoke(new Contacts_ResetTopPeerRating
{
category = category,
peer = peer,
});
/// Removes all contacts without an associated Telegram account. See
public static Task Contacts_ResetSaved(this Client client)
=> client.Invoke(new Contacts_ResetSaved
{
});
/// Get all contacts, requires a takeout session, see here » for more info. See Possible codes: 403 (details)
public static Task Contacts_GetSaved(this Client client)
=> client.Invoke(new Contacts_GetSaved
{
});
/// Enable/disable top peers See
/// Enable/disable
public static Task Contacts_ToggleTopPeers(this Client client, bool enabled)
=> client.Invoke(new Contacts_ToggleTopPeers
{
enabled = enabled,
});
/// Add an existing telegram user as contact. See Possible codes: 400 (details)
/// Allow the other user to see our phone number?
/// Telegram ID of the other user
/// First name
/// Last name
/// User's phone number, may be omitted to simply add the user to the contact list, without a phone number.
public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, bool add_phone_privacy_exception = false)
=> client.Invoke(new Contacts_AddContact
{
flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0),
id = id,
first_name = first_name,
last_name = last_name,
phone = phone,
});
/// If the add contact action bar is active, add that user as contact See Possible codes: 400 (details)
/// The user to add as contact
public static Task Contacts_AcceptContact(this Client client, InputUserBase id)
=> client.Invoke(new Contacts_AcceptContact
{
id = id,
});
/// Get users and geochats near you, see here » for more info. See Possible codes: 400,406 (details)
/// While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown.
/// Geolocation
/// If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied.
public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, int? self_expires = null, bool background = false)
=> client.Invoke(new Contacts_GetLocated
{
flags = (Contacts_GetLocated.Flags)((self_expires != null ? 0x1 : 0) | (background ? 0x2 : 0)),
geo_point = geo_point,
self_expires = self_expires.GetValueOrDefault(),
});
/// Stop getting notifications about discussion replies of a certain user in @replies See Possible codes: 400 (details)
/// Whether to delete the specified message as well
/// Whether to delete all @replies messages from this user as well
/// Whether to also report this user for spam
/// ID of the message in the @replies chat
public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false)
=> client.Invoke(new Contacts_BlockFromReplies
{
flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)),
msg_id = msg_id,
});
/// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: 400 (details)
/// Phone number in international format, possibly obtained from a phone number deep link.
public static Task Contacts_ResolvePhone(this Client client, string phone)
=> client.Invoke(new Contacts_ResolvePhone
{
phone = phone,
});
/// Generates a temporary profile link for the currently logged-in user. See [bots: ✓]
public static Task Contacts_ExportContactToken(this Client client)
=> client.Invoke(new Contacts_ExportContactToken
{
});
/// Obtain user info from a temporary profile link. See [bots: ✓] Possible codes: 400 (details)
/// The token extracted from the temporary profile link.
public static Task Contacts_ImportContactToken(this Client client, string token)
=> client.Invoke(new Contacts_ImportContactToken
{
token = token,
});
/// Edit the close friends list, see here » for more info. See
/// Full list of user IDs of close friends, see here for more info.
public static Task Contacts_EditCloseFriends(this Client client, params long[] id)
=> client.Invoke(new Contacts_EditCloseFriends
{
id = id,
});
/// Replace the contents of an entire blocklist, see here for more info ». See
/// Whether to edit the story blocklist; if not set, will edit the main blocklist. See here » for differences between the two.
/// Full content of the blocklist.
/// Maximum number of results to return, see pagination
public static Task Contacts_SetBlocked(this Client client, InputPeer[] id, int limit = int.MaxValue, bool my_stories_from = false)
=> client.Invoke(new Contacts_SetBlocked
{
flags = (Contacts_SetBlocked.Flags)(my_stories_from ? 0x1 : 0),
id = id,
limit = limit,
});
/// See
public static Task Contacts_GetBirthdays(this Client client)
=> client.Invoke(new Contacts_GetBirthdays
{
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Returns the list of messages by their IDs. See [bots: ✓]
/// Message ID list
public static Task Messages_GetMessages(this Client client, params InputMessage[] id)
=> client.Invoke(new Messages_GetMessages
{
id = id,
});
/// Returns the current user dialog list. See Possible codes: 400,403 (details)
/// Exclude pinned dialogs
/// Peer folder ID, for more info click here
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here (top_message ID used for pagination)
/// Offset peer for pagination
/// Number of list elements to be returned
/// Hash for pagination, for more info click here
public static Task Messages_GetDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, int? folder_id = null, bool exclude_pinned = false)
=> client.Invoke(new Messages_GetDialogs
{
flags = (Messages_GetDialogs.Flags)((folder_id != null ? 0x2 : 0) | (exclude_pinned ? 0x1 : 0)),
folder_id = folder_id.GetValueOrDefault(),
offset_date = offset_date,
offset_id = offset_id,
offset_peer = offset_peer,
limit = limit,
hash = hash,
});
/// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details)
/// Target peer
/// Only return messages starting from the specified message ID
/// Only return messages sent before the specified date
/// Number of list elements to be skipped, negative values are also accepted.
/// Number of results to return
/// If a positive value was transferred, the method will return only messages with IDs less than max_id
/// If a positive value was transferred, the method will return only messages with IDs more than min_id
/// Result hash
public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default)
=> client.Invoke(new Messages_GetHistory
{
peer = peer,
offset_id = offset_id,
offset_date = offset_date,
add_offset = add_offset,
limit = limit,
max_id = max_id,
min_id = min_id,
hash = hash,
});
/// Search for messages. See Possible codes: 400,403 (details)
/// User or chat, histories with which are searched, or to search in all private chats and normal groups (not channels) ». Use Messages_SearchGlobal to search globally in all chats, groups, supergroups and channels.
/// Text search request
/// Only return messages sent by the specified user ID
/// Search within the saved message dialog » with this ID.
/// Thread ID
/// Filter to return only specified message types
/// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned
/// If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned
/// Only return messages starting from the specified message ID
/// Additional offset
/// Number of results to return
/// Maximum message ID to return
/// Minimum message ID to return
/// Hash
public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null, InputPeer saved_peer_id = null, Reaction[] saved_reaction = null)
=> client.Invoke(new Messages_Search
{
flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0) | (saved_peer_id != null ? 0x4 : 0) | (saved_reaction != null ? 0x8 : 0)),
peer = peer,
q = q,
from_id = from_id,
saved_peer_id = saved_peer_id,
saved_reaction = saved_reaction,
top_msg_id = top_msg_id.GetValueOrDefault(),
filter = filter,
min_date = min_date,
max_date = max_date,
offset_id = offset_id,
add_offset = add_offset,
limit = limit,
max_id = max_id,
min_id = min_id,
hash = hash,
});
/// Marks message history as read. See Possible codes: 400 (details)
/// Target user or group
/// If a positive value is passed, only messages with identifiers less or equal than the given one will be read
public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id = default)
=> client.InvokeAffected(new Messages_ReadHistory
{
peer = peer,
max_id = max_id,
}, peer is InputPeerChannel ipc ? ipc.channel_id : 0);
/// Deletes communication history. See Possible codes: 400 (details)
/// Just clear history for the current user, without actually removing messages for every chat user
/// Whether to delete the message history for all chat participants
/// User or chat, communication history of which will be deleted
/// Maximum ID of message to delete
/// Delete all messages newer than this UNIX timestamp
/// Delete all messages older than this UNIX timestamp
public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null, bool just_clear = false, bool revoke = false)
=> client.InvokeAffected(new Messages_DeleteHistory
{
flags = (Messages_DeleteHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0) | (just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0)),
peer = peer,
max_id = max_id,
min_date = min_date.GetValueOrDefault(),
max_date = max_date.GetValueOrDefault(),
}, peer is InputPeerChannel ipc ? ipc.channel_id : 0);
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat
/// Message ID list
public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false)
=> client.InvokeAffected(new Messages_DeleteMessages
{
flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0),
id = id,
}, 0);
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client.
public static Task Messages_ReceivedMessages(this Client client, int max_id = default)
=> client.Invoke(new Messages_ReceivedMessages
{
max_id = max_id,
});
/// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details)
/// Target user or group
/// Topic ID
/// Type of action
public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null)
=> client.Invoke(new Messages_SetTyping
{
flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0),
peer = peer,
top_msg_id = top_msg_id.GetValueOrDefault(),
action = action,
});
/// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,406,420,500 (details)
/// Set this flag to disable generation of the webpage preview
/// Send this message silently (no notifications for the receivers)
/// Send this message as background message
/// Clear the draft field
/// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled
/// Whether to move used stickersets to top, see here for more info on this flag »
/// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
/// The destination where the message will be sent
/// If set, indicates that the message should be sent in reply to the specified message or story.
/// The message
/// Unique client message ID required to prevent message resending You can use
/// Reply markup for sending bot buttons
/// Message entities for sending styled text
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false)
=> client.Invoke(new Messages_SendMessage
{
flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)),
peer = peer,
reply_to = reply_to,
message = message,
random_id = random_id,
reply_markup = reply_markup,
entities = entities,
schedule_date = schedule_date.GetValueOrDefault(),
send_as = send_as,
quick_reply_shortcut = quick_reply_shortcut,
});
/// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details)
/// Send message silently (no notification should be triggered)
/// Send message in background
/// Clear the draft
/// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled
/// Whether to move used stickersets to top, see here for more info on this flag »
/// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
/// Destination
/// If set, indicates that the message should be sent in reply to the specified message or story.
/// Attached media
/// Caption
/// Random ID to avoid resending the same message You can use
/// Reply markup for bot keyboards
/// Message entities for styled text
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false)
=> client.Invoke(new Messages_SendMedia
{
flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)),
peer = peer,
reply_to = reply_to,
media = media,
message = message,
random_id = random_id,
reply_markup = reply_markup,
entities = entities,
schedule_date = schedule_date.GetValueOrDefault(),
send_as = send_as,
quick_reply_shortcut = quick_reply_shortcut,
});
/// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details)
/// Whether to send messages silently (no notification will be triggered on the destination clients)
/// Whether to send the message in background
/// When forwarding games, whether to include your score in the game
/// Whether to forward messages without quoting the original author
/// Whether to strip captions from media
/// Only for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled
/// Source of messages
/// IDs of messages
/// Random ID to prevent resending of messages You can use
/// Destination peer
/// Destination forum topic
/// Scheduled message date for scheduled messages
/// Forward the messages as the specified peer
public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false)
=> client.Invoke(new Messages_ForwardMessages
{
flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0)),
from_peer = from_peer,
id = id,
random_id = random_id,
to_peer = to_peer,
top_msg_id = top_msg_id.GetValueOrDefault(),
schedule_date = schedule_date.GetValueOrDefault(),
send_as = send_as,
quick_reply_shortcut = quick_reply_shortcut,
});
/// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details)
/// Peer to report
public static Task Messages_ReportSpam(this Client client, InputPeer peer)
=> client.Invoke(new Messages_ReportSpam
{
peer = peer,
});
/// Get peer settings See Possible codes: 400 (details)
/// The peer
public static Task Messages_GetPeerSettings(this Client client, InputPeer peer)
=> client.Invoke(new Messages_GetPeerSettings
{
peer = peer,
});
/// Report a message in a chat for violation of telegram's Terms of Service See Possible codes: 400 (details)
/// Peer
/// IDs of messages to report
/// Why are these messages being reported
/// Comment for report moderation
public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message)
=> client.Invoke(new Messages_Report
{
peer = peer,
id = id,
reason = reason,
message = message,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details)
/// List of chat IDs
public static Task Messages_GetChats(this Client client, params long[] id)
=> client.Invoke(new Messages_GetChats
{
id = id,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
/// Basic group ID.
public static Task Messages_GetFullChat(this Client client, long chat_id)
=> client.Invoke(new Messages_GetFullChat
{
chat_id = chat_id,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID
/// New chat name, different from the old one
public static Task Messages_EditChatTitle(this Client client, long chat_id, string title)
=> client.Invoke(new Messages_EditChatTitle
{
chat_id = chat_id,
title = title,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
/// Chat ID
/// Photo to be set
public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo)
=> client.Invoke(new Messages_EditChatPhoto
{
chat_id = chat_id,
photo = photo,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
/// Chat ID
/// User ID to be added
/// Number of last messages to be forwarded
public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit)
=> client.Invoke(new Messages_AddChatUser
{
chat_id = chat_id,
user_id = user_id,
fwd_limit = fwd_limit,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Remove the entire chat history of the specified user in this chat.
/// Chat ID
/// User ID to be deleted
public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false)
=> client.Invoke(new Messages_DeleteChatUser
{
flags = (Messages_DeleteChatUser.Flags)(revoke_history ? 0x1 : 0),
chat_id = chat_id,
user_id = user_id,
});
/// Creates a new chat. See Possible codes: 400,406,500 (details)
/// List of user IDs to be invited
/// Chat name
/// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later.
public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null)
=> client.Invoke(new Messages_CreateChat
{
flags = (Messages_CreateChat.Flags)(ttl_period != null ? 0x1 : 0),
users = users,
title = title,
ttl_period = ttl_period.GetValueOrDefault(),
});
/// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details)
/// Value of the version parameter from , available at the client
/// Length of the required random sequence
public static Task Messages_GetDhConfig(this Client client, int version, int random_length)
=> client.Invoke(new Messages_GetDhConfig
{
version = version,
random_length = random_length,
});
/// Sends a request to start a secret chat to the user. See Possible codes: 400 (details)
/// User ID
/// Unique client request ID required to prevent resending. This also doubles as the chat ID.
/// A = g ^ a mod p, see Wikipedia
public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a)
=> client.Invoke(new Messages_RequestEncryption
{
user_id = user_id,
random_id = random_id,
g_a = g_a,
});
/// Confirms creation of a secret chat See Possible codes: 400 (details)
/// Secret chat ID
/// B = g ^ b mod p, see Wikipedia
/// 64-bit fingerprint of the received key
public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint)
=> client.Invoke(new Messages_AcceptEncryption
{
peer = peer,
g_b = g_b,
key_fingerprint = key_fingerprint,
});
/// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details)
/// Whether to delete the entire chat history for the other user as well
/// Secret chat ID
public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false)
=> client.Invoke(new Messages_DiscardEncryption
{
flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0),
chat_id = chat_id,
});
/// Send typing event by the current user to a secret chat. See Possible codes: 400 (details)
/// Secret chat ID
/// Typing.
Possible values:
, if the user started typing and more than 5 seconds have passed since the last request
, if the user stopped typing
public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing)
=> client.Invoke(new Messages_SetEncryptedTyping
{
peer = peer,
typing = typing,
});
/// Marks message history within a secret chat as read. See Possible codes: 400 (details)
/// Secret chat ID
/// Maximum date value for received messages in history
public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date = default)
=> client.Invoke(new Messages_ReadEncryptedHistory
{
peer = peer,
max_date = max_date,
});
/// Sends a text message to a secret chat. See Possible codes: 400,403,500 (details)
/// Send encrypted message without a notification
/// Secret chat ID
/// Unique client message ID, necessary to avoid message resending You can use
/// TL-serialization of type, encrypted with a key that was created during chat initialization
public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false)
=> client.Invoke(new Messages_SendEncrypted
{
flags = (Messages_SendEncrypted.Flags)(silent ? 0x1 : 0),
peer = peer,
random_id = random_id,
data = data,
});
/// Sends a message with a file attachment to a secret chat See Possible codes: 400 (details)
/// Whether to send the file without triggering a notification
/// Secret chat ID
/// Unique client message ID necessary to prevent message resending You can use
/// TL-serialization of type, encrypted with a key generated during chat initialization
/// File attachment for the secret chat
public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false)
=> client.Invoke(new Messages_SendEncryptedFile
{
flags = (Messages_SendEncryptedFile.Flags)(silent ? 0x1 : 0),
peer = peer,
random_id = random_id,
data = data,
file = file,
});
/// Sends a service message to a secret chat. See Possible codes: 400,403,500 (details)
/// Secret chat ID
/// Unique client message ID required to prevent message resending You can use
/// TL-serialization of type, encrypted with a key generated during chat initialization
public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data)
=> client.Invoke(new Messages_SendEncryptedService
{
peer = peer,
random_id = random_id,
data = data,
});
/// Confirms receipt of messages in a secret chat by client, cancels push notifications.
The method returns a list of random_ids of messages for which push notifications were cancelled. See Possible codes: 400,500 (details)
/// Maximum qts value available at the client
public static Task Messages_ReceivedQueue(this Client client, int max_qts)
=> client.Invoke(new Messages_ReceivedQueue
{
max_qts = max_qts,
});
/// Report a secret chat for spam See Possible codes: 400 (details)
/// The secret chat to report
public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer)
=> client.Invoke(new Messages_ReportEncryptedSpam
{
peer = peer,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list
public static Task Messages_ReadMessageContents(this Client client, params int[] id)
=> client.InvokeAffected(new Messages_ReadMessageContents
{
id = id,
}, 0);
/// Get stickers by emoji See Possible codes: 400 (details)
/// The emoji
/// Hash for pagination, for more info click here
/// a null value means messages.stickersNotModified
public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default)
=> client.Invoke(new Messages_GetStickers
{
emoticon = emoticon,
hash = hash,
});
/// Get all installed stickers See
/// Hash for pagination, for more info click here
/// a null value means messages.allStickersNotModified
public static Task Messages_GetAllStickers(this Client client, long hash = default)
=> client.Invoke(new Messages_GetAllStickers
{
hash = hash,
});
/// Get preview of webpage See Possible codes: 400 (details)
/// Message from which to extract the preview
/// Message entities for styled text
/// a null value means messageMediaEmpty
public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null)
=> client.Invoke(new Messages_GetWebPagePreview
{
flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0),
message = message,
entities = entities,
});
/// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details)
/// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients.
/// Whether admin confirmation is required before admitting each separate user into the chat
/// Chat
/// Expiration date
/// Maximum number of users that can join using this link
/// Description of the invite link, visible only to administrators
public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, DateTime? expire_date = null, int? usage_limit = null, string title = null, bool legacy_revoke_permanent = false, bool request_needed = false)
=> client.Invoke(new Messages_ExportChatInvite
{
flags = (Messages_ExportChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0) | (legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0)),
peer = peer,
expire_date = expire_date.GetValueOrDefault(),
usage_limit = usage_limit.GetValueOrDefault(),
title = title,
});
/// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details)
/// Invite hash from chat invite deep link ».
public static Task Messages_CheckChatInvite(this Client client, string hash)
=> client.Invoke(new Messages_CheckChatInvite
{
hash = hash,
});
/// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details)
/// hash from a chat invite deep link
public static Task Messages_ImportChatInvite(this Client client, string hash)
=> client.Invoke(new Messages_ImportChatInvite
{
hash = hash,
});
/// Get info about a stickerset See [bots: ✓] Possible codes: 400,406 (details)
/// Stickerset
/// Hash for pagination, for more info click here
/// a null value means messages.stickerSetNotModified
public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash = default)
=> client.Invoke(new Messages_GetStickerSet
{
stickerset = stickerset,
hash = hash,
});
/// Install a stickerset See Possible codes: 406 (details)
/// Stickerset to install
/// Whether to archive stickerset
public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived)
=> client.Invoke(new Messages_InstallStickerSet
{
stickerset = stickerset,
archived = archived,
});
/// Uninstall a stickerset See Possible codes: 406 (details)
/// The stickerset to uninstall
public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset)
=> client.Invoke(new Messages_UninstallStickerSet
{
stickerset = stickerset,
});
/// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details)
/// The bot
/// The chat where to start the bot, can be the bot's private chat or a group
/// Random ID to avoid resending the same message You can use
/// Deep linking parameter
public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param)
=> client.Invoke(new Messages_StartBot
{
bot = bot,
peer = peer,
random_id = random_id,
start_param = start_param,
});
/// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details)
/// Peer where the message was found
/// ID of message
/// Whether to mark the message as viewed and increment the view counter
public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment)
=> client.Invoke(new Messages_GetMessagesViews
{
peer = peer,
id = id,
increment = increment,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Make a user admin in a basic group. See Possible codes: 400 (details)
/// The ID of the group
/// The user to make admin
/// Whether to make them admin
public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin)
=> client.Invoke(new Messages_EditChatAdmin
{
chat_id = chat_id,
user_id = user_id,
is_admin = is_admin,
});
/// ⚠ This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
/// Basic group to migrate
public static Task Messages_MigrateChat(this Client client, long chat_id)
=> client.Invoke(new Messages_MigrateChat
{
chat_id = chat_id,
});
/// Search for messages and peers globally See Possible codes: 400 (details)
/// Peer folder ID, for more info click here
/// Query
/// Global search filter
/// If a positive value was specified, the method will return only messages with date bigger than min_date
/// If a positive value was transferred, the method will return only messages with date smaller than max_date
/// Initially 0, then set to the next_rate parameter of messages.messagesSlice
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null, bool broadcasts_only = false)
=> client.Invoke(new Messages_SearchGlobal
{
flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0)),
folder_id = folder_id.GetValueOrDefault(),
q = q,
filter = filter,
min_date = min_date,
max_date = max_date,
offset_rate = offset_rate,
offset_peer = offset_peer,
offset_id = offset_id,
limit = limit,
});
/// Reorder installed stickersets See
/// Reorder mask stickersets
/// Reorder custom emoji stickersets
/// New stickerset order by stickerset IDs
public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false)
=> client.Invoke(new Messages_ReorderStickerSets
{
flags = (Messages_ReorderStickerSets.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)),
order = order,
});
/// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details)
/// SHA256 of file
/// Size of the file in bytes
/// Mime type
public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, long size, string mime_type)
=> client.Invoke(new Messages_GetDocumentByHash
{
sha256 = sha256,
size = size,
mime_type = mime_type,
});
/// Get saved GIFs See
/// Hash for pagination, for more info click here
/// a null value means messages.savedGifsNotModified
public static Task Messages_GetSavedGifs(this Client client, long hash = default)
=> client.Invoke(new Messages_GetSavedGifs
{
hash = hash,
});
/// Add GIF to saved gifs list See Possible codes: 400 (details)
/// GIF to save
/// Whether to remove GIF from saved gifs list
public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave)
=> client.Invoke(new Messages_SaveGif
{
id = id,
unsave = unsave,
});
/// Query an inline bot See Possible codes: 400,406,-503 (details)
/// The bot to query
/// The currently opened chat
/// The geolocation, if requested
/// The query
/// The offset within the results, will be passed directly as-is to the bot.
public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null)
=> client.Invoke(new Messages_GetInlineBotResults
{
flags = (Messages_GetInlineBotResults.Flags)(geo_point != null ? 0x1 : 0),
bot = bot,
peer = peer,
geo_point = geo_point,
query = query,
offset = offset,
});
/// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (details)
/// Set this flag if the results are composed of media files
/// Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
/// Unique identifier for the answered query
/// Vector of results for the inline query
/// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
/// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
/// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter.
/// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified inline mode mini app.
public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, int cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false)
=> client.Invoke(new Messages_SetInlineBotResults
{
flags = (Messages_SetInlineBotResults.Flags)((next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0) | (switch_webview != null ? 0x10 : 0) | (gallery ? 0x1 : 0) | (private_ ? 0x2 : 0)),
query_id = query_id,
results = results,
cache_time = cache_time,
next_offset = next_offset,
switch_pm = switch_pm,
switch_webview = switch_webview,
});
/// Send a result obtained using Messages_GetInlineBotResults. See Possible codes: 400,403,420,500 (details)
/// Whether to send the message silently (no notification will be triggered on the other client)
/// Whether to send the message in background
/// Whether to clear the draft
/// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the )
/// Destination
/// If set, indicates that the message should be sent in reply to the specified message or story.
/// Random ID to avoid resending the same query You can use
/// Query ID from Messages_GetInlineBotResults
/// Result ID from Messages_GetInlineBotResults
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false)
=> client.Invoke(new Messages_SendInlineBotResult
{
flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)),
peer = peer,
reply_to = reply_to,
random_id = random_id,
query_id = query_id,
id = id,
schedule_date = schedule_date.GetValueOrDefault(),
send_as = send_as,
quick_reply_shortcut = quick_reply_shortcut,
});
/// Find out if a media message's caption can be edited See