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() {constresult:Api.Updates,contains all the latest updateDraftMessage updates related to all chats with drafts. =awaitclient.invoke(newApi.messages.getAllDrafts({ }));console.log(result); // prints the result})();