breaking: pretty much the entire storage thing has been overhauled. migrations from older versions **are not** available, please do them manually through string sessions
14 lines
421 B
TypeScript
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 }
|
|
}
|
|
}
|