Guides

Chat Navigation

Main Walkthrough 24 of 25

Clients can retrieve chats and control whether they are open in the Telegram interface.

Resolving a Public Chat

resolveUsername resolves a public username without the leading @.

const chat = await client.resolveUsername("telegram");

Getting a Chat

getChat returns complete chat information.

const chat = await client.getChat(chatId);

Getting a Chat Peer

getChatP returns a chat’s peer representation.

const peer = await client.getChatP(chatId);

Opening and Closing a Chat

openChat and closeChat notify Telegram when the interface opens or closes a chat.

await client.openChat(chatId);
await client.closeChat(chatId);

Leaving a Chat

leaveChat leaves a group, supergroup, or channel.

await client.leaveChat(chatId);

Managing the Sticker Set

setChatStickerSet assigns a sticker set to a supergroup; deleteChatStickerSet removes it.

await client.setChatStickerSet(chatId, stickerSetSlug);
await client.deleteChatStickerSet(chatId);