diff --git a/commands/Music/clip.js b/commands/Music/clip.js index 6ea1a0c7..de287a0e 100644 --- a/commands/Music/clip.js +++ b/commands/Music/clip.js @@ -1,6 +1,6 @@ const Command = require("../../base/Command"), fs = require("fs"), - { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection } = require("@discordjs/voice"); + { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection, AudioPlayerStatus } = require("@discordjs/voice"); class Clip extends Command { constructor(client) { @@ -38,17 +38,17 @@ class Clip extends Command { const resource = createAudioResource(fs.createReadStream(`./clips/${clip}.mp3`)); const player = createAudioPlayer() - .on("error", error => { + .on("error", err => { connection.destroy(); - console.error("Error:", error.message, "with track", error.resource.metadata.title); + console.error(err.message); }); player.play(resource); connection.subscribe(player); - setTimeout(() => { + player.on(AudioPlayerStatus.Idle, () => { connection.destroy(); - }, 60 * 1000); + }); } catch (error) { console.error(error); } diff --git a/dashboard/public/docs/updates.md b/dashboard/public/docs/updates.md index 45e341e4..abe93be9 100644 --- a/dashboard/public/docs/updates.md +++ b/dashboard/public/docs/updates.md @@ -1,3 +1,7 @@ +### JaBa v3.3.8 +* Исправления + * Команда *clip* теперь работает нормально. + ### JaBa v3.3.7 * Добавлено * Локализация необходимых прав в ошибке. diff --git a/package.json b/package.json index 194d8dd3..c066ee3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "3.3.7", + "version": "3.3.8", "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "main": "index.js", "private": true,