fix: premature close

This commit is contained in:
Snowflake107 2021-06-20 01:33:48 +05:45
parent 9fc0d9dde6
commit 2bb209baf5
3 changed files with 5 additions and 4 deletions

View file

@ -51,7 +51,7 @@
"homepage": "https://discord-player.js.org",
"dependencies": {
"@discordjs/voice": "^0.5.0",
"discord-ytdl-core": "^5.0.3",
"discord-ytdl-core": "^5.0.4",
"libsodium-wrappers": "^0.7.9",
"soundcloud-scraper": "^5.0.0",
"spotify-url-info": "^2.2.3",

View file

@ -220,6 +220,7 @@ class Queue<T = unknown> {
const newFilters = AudioFilters.create(_filters);
return await this.play(this.current, {
immediate: true,
filtersUpdate: true,
seek: this.streamTime,
encoderArgs: ["-af", newFilters]
@ -267,7 +268,7 @@ class Queue<T = unknown> {
fmt: "s16le",
encoderArgs: options.encoderArgs ?? [],
seek: options.seek
}).on("error", (err) => this.player.emit("error", this, err));
}).on("error", (err) => (err.message.toLowerCase().includes("premature close") ? null : this.player.emit("error", this, err)));
} else {
stream = ytdl
.arbitraryStream(
@ -279,7 +280,7 @@ class Queue<T = unknown> {
seek: options.seek
}
)
.on("error", (err) => this.player.emit("error", this, err));
.on("error", (err) => (err.message.toLowerCase().includes("premature close") ? null : this.player.emit("error", this, err)));
}
const resource: AudioResource<Track> = this.connection.createStream(stream, {

View file

@ -78,7 +78,7 @@ const FilterList = {
},
toString() {
return this.names.map(m => (this as any)[m]).join(",");
return this.names.map((m) => (this as any)[m]).join(",");
},
create(filter?: FiltersName[]): string {