fix(core): remove type assertion from channels.readHistory

for some reason it returns false sometimes 🥴
closes #84
This commit is contained in:
alina 🌸 2024-12-31 23:10:09 +03:00
parent 766f0399f1
commit fe722fbb61
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -1,6 +1,5 @@
import type { ITelegramClient } from '../../client.types.js' import type { ITelegramClient } from '../../client.types.js'
import type { InputPeerLike } from '../../types/index.js' import type { InputPeerLike } from '../../types/index.js'
import { assertTrue } from '../../../utils/type-assertions.js'
import { createDummyUpdate } from '../../updates/utils.js' import { createDummyUpdate } from '../../updates/utils.js'
import { isInputPeerChannel, toInputChannel } from '../../utils/peer-utils.js' import { isInputPeerChannel, toInputChannel } from '../../utils/peer-utils.js'
import { resolvePeer } from '../users/resolve-peer.js' import { resolvePeer } from '../users/resolve-peer.js'
@ -53,13 +52,11 @@ export async function readHistory(
} }
if (isInputPeerChannel(peer)) { if (isInputPeerChannel(peer)) {
const r = await client.call({ await client.call({
_: 'channels.readHistory', _: 'channels.readHistory',
channel: toInputChannel(peer), channel: toInputChannel(peer),
maxId, maxId,
}) })
assertTrue('channels.readHistory', r)
} else { } else {
const res = await client.call({ const res = await client.call({
_: 'messages.readHistory', _: 'messages.readHistory',