Guides

Account and App SettingsUSER-ONLY

User Walkthrough 25 of 50

Users can manage general account behavior and retrieve Telegram app information.

Updating the Profile

updateProfile changes the current user’s name or bio.

await client.updateProfile({ firstName: "Ada", bio: "Hello" });

setIsOnline updates the account’s online status.

await client.setIsOnline(true);

Emoji Statuses

setEmojiStatus and removeEmojiStatus set or remove the account’s status.

await client.setEmojiStatus({ type: "customEmoji", customEmojiId });
await client.removeEmojiStatus();

Channels have corresponding setChannelEmojiStatus and removeChannelEmojiStatus methods.

await client.setChannelEmojiStatus(channelId, { type: "customEmoji", customEmojiId });
await client.removeChannelEmojiStatus(channelId);

Recent statuses come from getRecentEmojiStatuses and can be cleared with clearRecentEmojiStatuses.

const statuses = await client.getRecentEmojiStatuses();
await client.clearRecentEmojiStatuses();

Bot Permissions

allowBotToSetCustomEmojiStatus and disallowBotToSetCustomEmojiStatus grant or revoke a bot’s permission to change the status.

await client.allowBotToSetCustomEmojiStatus(botId);
await client.disallowBotToSetCustomEmojiStatus(botId);

Attachment-menu bots are managed through addBotToAttachmentsMenu and removeBotFromAttachmentsMenu.

await client.addBotToAttachmentsMenu(botId);
await client.removeBotFromAttachmentsMenu(botId);

Exceptions for paid incoming messages are managed by allowUnpaidMessagesFromUser and disallowUnpaidMessagesFromUser.

await client.allowUnpaidMessagesFromUser(userId);
await client.disallowUnpaidMessagesFromUser(userId);

New Chats

getArchiveAndMuteNewChatsFromUnknownUsers reads the automatic-archiving setting, and setArchiveAndMuteNewChatsFromUnknownUsers changes it.

const isEnabled = await client.getArchiveAndMuteNewChatsFromUnknownUsers();
await client.setArchiveAndMuteNewChatsFromUnknownUsers(true);

getNewChatPrivacy and setNewChatPrivacy control who can start new chats with the account.

const privacy = await client.getNewChatPrivacy();
await client.setNewChatPrivacy({
  isNewChatFromNonPremiumUsersAllowed: true,
  messagePrice: 0,
});

Gifts

Gift visibility is available through getGiftPrivacy and setGiftPrivacy.

const privacy = await client.getGiftPrivacy();
await client.setGiftPrivacy({
  isGiftButtonDisplayed: true,
  isRegularGiftAccepted: true,
});

Sponsored messages are controlled by enableSponsoredMessages and disableSponsoredMessages.

await client.enableSponsoredMessages();
await client.disableSponsoredMessages();

Deleting the Account

Permanently delete the current account through deleteAccount.

await client.deleteAccount("No longer needed");