mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 22:24:58 +05:00
v4.1.4
Фикс ошибок в clips, loop, nowplaying и play
This commit is contained in:
parent
8909532acf
commit
dc6a9d23e5
6 changed files with 24 additions and 18 deletions
|
@ -36,7 +36,12 @@ class Clips extends BaseCommand {
|
||||||
fs.readdir("./clips", async function (err, files) {
|
fs.readdir("./clips", async function (err, files) {
|
||||||
await interaction.deferReply();
|
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 clips = files.map(file => {
|
||||||
const fileName = file.substring(0, file.length - 4);
|
const fileName = file.substring(0, file.length - 4);
|
||||||
|
|
|
@ -35,9 +35,9 @@ class Loop extends BaseCommand {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const voice = interaction.member.voice.channel;
|
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);
|
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()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
|
|
|
@ -33,8 +33,9 @@ class Nowplaying extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const queue = client.player.getQueue(interaction.guildId);
|
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 progressBar = queue.createProgressBar();
|
||||||
const track = queue.current;
|
const track = queue.current;
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@ class Play extends BaseCommand {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const voice = interaction.member.voice.channel;
|
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 query = interaction.options.getString("query");
|
||||||
const perms = voice.permissionsFor(client.user);
|
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 {
|
try {
|
||||||
var searchResult = await client.player.search(query, {
|
var searchResult = await client.player.search(query, {
|
||||||
|
@ -50,7 +50,7 @@ class Play extends BaseCommand {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!searchResult.tracks[0] || !searchResult)
|
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) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return interaction.editReply({
|
return interaction.editReply({
|
||||||
|
|
18
package-lock.json
generated
18
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.1.3",
|
"version": "4.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.1.3",
|
"version": "4.1.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discord-player/extractor": "^3.0.2",
|
"@discord-player/extractor": "^3.0.2",
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
"cron": "^2.1.0",
|
"cron": "^2.1.0",
|
||||||
"discord-api-types": "^0.37.5",
|
"discord-api-types": "^0.37.5",
|
||||||
"discord-giveaways": "^6.0.1",
|
"discord-giveaways": "^6.0.1",
|
||||||
"discord-player-play-dl": "^5.3.5",
|
"discord-player-play-dl": "^5.3.6",
|
||||||
"discord.js": "^14.3.0",
|
"discord.js": "^14.3.0",
|
||||||
"ejs": "^3.1.3",
|
"ejs": "^3.1.3",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
@ -1480,9 +1480,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/discord-player-play-dl": {
|
"node_modules/discord-player-play-dl": {
|
||||||
"version": "5.3.5",
|
"version": "5.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz",
|
||||||
"integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==",
|
"integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/voice": "^0.11.0",
|
"@discordjs/voice": "^0.11.0",
|
||||||
"libsodium-wrappers": "^0.7.10",
|
"libsodium-wrappers": "^0.7.10",
|
||||||
|
@ -5837,9 +5837,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"discord-player-play-dl": {
|
"discord-player-play-dl": {
|
||||||
"version": "5.3.5",
|
"version": "5.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz",
|
||||||
"integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==",
|
"integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@discordjs/voice": "^0.11.0",
|
"@discordjs/voice": "^0.11.0",
|
||||||
"libsodium-wrappers": "^0.7.10",
|
"libsodium-wrappers": "^0.7.10",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.1.3",
|
"version": "4.1.4",
|
||||||
"description": "My Discord Bot",
|
"description": "My Discord Bot",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"cron": "^2.1.0",
|
"cron": "^2.1.0",
|
||||||
"discord-api-types": "^0.37.5",
|
"discord-api-types": "^0.37.5",
|
||||||
"discord-giveaways": "^6.0.1",
|
"discord-giveaways": "^6.0.1",
|
||||||
"discord-player-play-dl": "^5.3.5",
|
"discord-player-play-dl": "^5.3.6",
|
||||||
"discord.js": "^14.3.0",
|
"discord.js": "^14.3.0",
|
||||||
"ejs": "^3.1.3",
|
"ejs": "^3.1.3",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
|
Loading…
Reference in a new issue