Фикс clip
This commit is contained in:
JonnyBro 2022-02-09 15:59:05 +05:00
parent 476ed2a8dd
commit 0454afd2bd
3 changed files with 10 additions and 6 deletions

View file

@ -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);
}

View file

@ -1,3 +1,7 @@
### JaBa v3.3.8
* Исправления
* Команда *clip* теперь работает нормально.
### JaBa v3.3.7
* Добавлено
* Локализация необходимых прав в ошибке.

View file

@ -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,