account.UpdateProfile
Updates user profile.
Example
const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result = await client.invoke(
new Api.account.UpdateProfile({
firstName: "some string here",
lastName: "some string here",
about: "some string here",
})
);
console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result: Api.User = await client.invoke(
new Api.account.UpdateProfile({
firstName: "some string here",
lastName: "some string here",
about: "some string here",
})
);
console.log(result); // prints the result
})();
Parameters
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
firstName | flags.0?string | New user first name |
lastName | flags.1?string | New user last name |
about | flags.2?string | New bio |
Result
Returns User object containing the updated current user profile.
Possible errors
Code | Type | Description |
---|---|---|
400 | ABOUT_TOO_LONG | About string too long. |
400 | FIRSTNAME_INVALID | The first name is invalid. |
Can bots use this method?
No