mtcute/packages/test/src/utils.ts
Alina Sireneva eca99a7535
refactor!: large refactor of storage implementation
breaking: pretty much the entire storage thing has been overhauled.
migrations from older versions **are not** available, please do them manually through string sessions
2024-01-04 00:22:26 +03:00

14 lines
421 B
TypeScript

import { parseMarkedPeerId, tl } 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 }
}
}