const {Api,TelegramClient} =require('telegram');const {StringSession} =require('telegram/sessions');constsession=newStringSession('');constclient=newTelegramClient(session, apiId, apiHash, {});(asyncfunctionrun() {constresult=awaitclient.invoke(newApi.messages.getAllDrafts({ }));console.log(result); // prints the result})();
import {Api, TelegramClient} from'telegram';import {StringSession} from'telegram/sessions';constsession=newStringSession('');constclient=newTelegramClient(session, apiId, apiHash, {});(asyncfunctionrun() { const result: Api.Updates, contains all the latest updateDraftMessage updates related to all chats with drafts. = await client.invoke(new Api.messages.getAllDrafts({
}));console.log(result); // prints the result})();