import { Api } from 'teleproto'; import bigInt from 'big-integer'; export function dialogPage(start: number, length: number, slice = false) { const users = Array.from({ length }, (_, i) => new Api.User({ id: bigInt(start + i), accessHash: bigInt(987654321), firstName: 'Fixture', contact: true })); const dialogs = users.map((u, i) => new Api.Dialog({ peer: new Api.PeerUser({ userId: u.id }), topMessage: start + i, readInboxMaxId: 0, readOutboxMaxId: 0, unreadCount: 0, unreadMentionsCount: 0, unreadReactionsCount: 0, notifySettings: new Api.PeerNotifySettings({}), pts: 0 })); const messages = dialogs.map(d => new Api.Message({ id: d.topMessage, peerId: d.peer, date: 1700000000 - d.topMessage, message: 'PRIVATE BODY' })); const args = { users, chats: [], dialogs, messages }; return slice ? new Api.messages.DialogsSlice({ ...args, count: 1000 }) : new Api.messages.Dialogs(args); }