Фикс ошибок в clips, loop, nowplaying и play
This commit is contained in:
JonnyBro 2022-09-13 22:19:51 +05:00
parent 8909532acf
commit dc6a9d23e5
6 changed files with 24 additions and 18 deletions

View file

@ -36,7 +36,12 @@ class Clips extends BaseCommand {
fs.readdir("./clips", async function (err, files) {
await interaction.deferReply();
if (err) return console.log("Unable to read directory: " + err);
if (err) {
interaction.editReply({
content: "```js\n" + err + "```"
});
return console.log("Unable to read directory: " + err);
}
const clips = files.map(file => {
const fileName = file.substring(0, file.length - 4);

View file

@ -35,9 +35,9 @@ class Loop extends BaseCommand {
await interaction.deferReply();
const voice = interaction.member.voice.channel;
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true });
const queue = client.player.getQueue(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
const row = new ActionRowBuilder()
.addComponents(

View file

@ -33,8 +33,9 @@ class Nowplaying extends BaseCommand {
*/
async execute(client, interaction) {
await interaction.deferReply();
const queue = client.player.getQueue(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
const progressBar = queue.createProgressBar();
const track = queue.current;

View file

@ -38,10 +38,10 @@ class Play extends BaseCommand {
await interaction.deferReply();
const voice = interaction.member.voice.channel;
if (!voice) return interaction.editReply({ content: interaction.translate("music/play:NO_VOICE_CHANNEL") });
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true });
const query = interaction.options.getString("query");
const perms = voice.permissionsFor(client.user);
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") });
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true });
try {
var searchResult = await client.player.search(query, {
@ -50,7 +50,7 @@ class Play extends BaseCommand {
});
if (!searchResult.tracks[0] || !searchResult)
return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Скорее всего видео заблокировано по региону" }) });
return interaction.error("music/play:NO_RESULT", { query, error: "Скорее всего видео заблокировано по региону" }, { edit: true });
} catch (error) {
console.log(error);
return interaction.editReply({

18
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "jaba",
"version": "4.1.3",
"version": "4.1.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "jaba",
"version": "4.1.3",
"version": "4.1.4",
"license": "ISC",
"dependencies": {
"@discord-player/extractor": "^3.0.2",
@ -20,7 +20,7 @@
"cron": "^2.1.0",
"discord-api-types": "^0.37.5",
"discord-giveaways": "^6.0.1",
"discord-player-play-dl": "^5.3.5",
"discord-player-play-dl": "^5.3.6",
"discord.js": "^14.3.0",
"ejs": "^3.1.3",
"express": "^4.17.1",
@ -1480,9 +1480,9 @@
}
},
"node_modules/discord-player-play-dl": {
"version": "5.3.5",
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz",
"integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==",
"version": "5.3.6",
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz",
"integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==",
"dependencies": {
"@discordjs/voice": "^0.11.0",
"libsodium-wrappers": "^0.7.10",
@ -5837,9 +5837,9 @@
}
},
"discord-player-play-dl": {
"version": "5.3.5",
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz",
"integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==",
"version": "5.3.6",
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz",
"integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==",
"requires": {
"@discordjs/voice": "^0.11.0",
"libsodium-wrappers": "^0.7.10",

View file

@ -1,6 +1,6 @@
{
"name": "jaba",
"version": "4.1.3",
"version": "4.1.4",
"description": "My Discord Bot",
"main": "index.js",
"private": true,
@ -23,7 +23,7 @@
"cron": "^2.1.0",
"discord-api-types": "^0.37.5",
"discord-giveaways": "^6.0.1",
"discord-player-play-dl": "^5.3.5",
"discord-player-play-dl": "^5.3.6",
"discord.js": "^14.3.0",
"ejs": "^3.1.3",
"express": "^4.17.1",