mtcute/packages/test/src/utils.ts

15 lines
456 B
TypeScript

import type { tl } from '@mtcute/core'
import { parseMarkedPeerId } from '@mtcute/core'
export function markedIdToPeer(id: number): tl.TypePeer {
const [type, bareId] = parseMarkedPeerId(id)
switch (type) {
case 'user':
return { _: 'peerUser', userId: bareId }
case 'chat':
return { _: 'peerChat', chatId: bareId }
case 'channel':
return { _: 'peerChannel', channelId: bareId }
}
}