account.checkUsername
Validates a username and checks availability.
Example
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');
const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
const result = await client.invoke(new Api.account.checkUsername({
username: 'random string here',
}));
console.log(result); // prints the result
})();
TL schema
boolFalse#bc799737 = Bool;
boolTrue#997275b5 = Bool;
---functions---
account.checkUsername#2714d86c username:string = Bool;
Parameters
Name
Type
Description
Accepted characters: A-z (case-insensitive), 0-9 and underscores. Length: 5-32 characters.|
Result
Return Bool result on whether the passed username can be used.
Possible errors
Code
Type
Description
400
USERNAME_INVALID
Unacceptable username
Can bots use this methd ?
yes
Related pages
Last updated
Was this helpful?