Closed ArnabXD closed 3 years ago
I see, I had some misunderstanding about stream.finish()
. But Stream.stop()
doesn't emit the 'finish'
event either (tgcalls ref). I understand that my suggestion maybe not necessary to gram-tgcalls
only if we emit finish event manually but gram-tgcalls
doesn't provide access to stream
or any way to emit finish
manually either.. So shouldn't we add skip like this ->
skip(chatId: number): boolean | null {
const connection = this.#connections.get(chatId);
if (connection) {
if (!connection.stream.finished) {
connection.stream.stop();
connestion.stream.emit('finish')
return true;
}
return false;
}
return null;
}
otherwise onFinish
won't even work right ?
There's a PR on the tgcalls repo to make stop
function emit finish
.
We simply wait for @AndrewLaneX to merge it, and I will just update the required tgcalls version instead of making the lib a bloat.
Meanwhile, you can install a version of tgcalls which emits finish
in stop
function with: npm i callsmusic/tgcalls
.
We simply wait for @AndrewLaneX to merge it, and I will just update the required tgcalls version instead of making the lib a bloat.
Sorry for the delay, I merged the PR.
Do you know you just nearly duplicated the
stop
function but renamed it toskip
?Plus
Stream.finish
doesn't stop the stream.