Skip to content

Commit

Permalink
Fix: reupload command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ballaual committed May 15, 2023
1 parent de4fa1d commit cf9879e
Show file tree
Hide file tree
Showing 44 changed files with 1,482 additions and 1,494 deletions.
108 changes: 54 additions & 54 deletions commands/Music/autoplay.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const distube = require('../../distubeClient');
const { SlashCommandBuilder } = require("@discordjs/builders")
const { EmbedBuilder } = require("discord.js")
const distube = require("../../distubeClient")

module.exports = {
data: new SlashCommandBuilder()
.setName('autoplay')
.setDescription('Enables or disables autoplay')
.setDMPermission(false),
category: 'music',
async execute(interaction) {
const queue = await distube.getQueue(interaction);
const voiceChannelId = interaction.member.voice.channelId;

if (!voiceChannelId) {
return interaction.reply({
content: 'Please join a voice channel first!',
ephemeral: true,
});
}

const botMember = interaction.guild.members.cache.get(
interaction.client.user.id,
);

if (!botMember.voice?.channelId) {
return interaction.reply({
content: 'I am not currently in a voice channel!',
ephemeral: true,
});
}

const botVoiceChannelId = botMember.voice.channelId;

if (voiceChannelId !== botVoiceChannelId) {
return interaction.reply({
content:
'You need to be in the same voice channel as the bot to use this command!',
ephemeral: true,
});
}

if (!queue) {
const queueError = new EmbedBuilder()
.setDescription('There is currently nothing to autoplay!')
.setColor('#FF0000');

return interaction.reply({ embeds: [queueError], ephemeral: true });
}

const mode = distube.toggleAutoplay(interaction);
return interaction.reply(
`Set autoplay mode to \`${mode ? 'On' : 'Off'}\``,
);
},
};
data: new SlashCommandBuilder()
.setName("autoplay")
.setDescription("Enables or disables autoplay")
.setDMPermission(false),
category: "music",
async execute (interaction) {
const queue = await distube.getQueue(interaction)
const voiceChannelId = interaction.member.voice.channelId

if (!voiceChannelId) {
return interaction.reply({
content: "Please join a voice channel first!",
ephemeral: true
})
}

const botMember = interaction.guild.members.cache.get(
interaction.client.user.id
)

if (!botMember.voice?.channelId) {
return interaction.reply({
content: "I am not currently in a voice channel!",
ephemeral: true
})
}

const botVoiceChannelId = botMember.voice.channelId

if (voiceChannelId !== botVoiceChannelId) {
return interaction.reply({
content:
"You need to be in the same voice channel as the bot to use this command!",
ephemeral: true
})
}

if (!queue) {
const queueError = new EmbedBuilder()
.setDescription("There is currently nothing to autoplay!")
.setColor("#FF0000")

return interaction.reply({ embeds: [queueError], ephemeral: true })
}

const mode = distube.toggleAutoplay(interaction)
return interaction.reply(
`Set autoplay mode to \`${mode ? "On" : "Off"}\``
)
}
}
126 changes: 63 additions & 63 deletions commands/Music/current.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const distube = require('../../distubeClient');
const { SlashCommandBuilder } = require("@discordjs/builders")
const { EmbedBuilder } = require("discord.js")
const distube = require("../../distubeClient")

const status = (queue) => {
const filterText = Array.isArray(queue.filters) ? queue.filters.join(', ') : 'Off';
return `Volume: \`${queue.volume}%\` | Loop: \`${queue.repeatMode ? queue.repeatMode === 2 ? 'All Queue' : 'This Song' : 'Off'}\` | Autoplay: \`${queue.autoplay ? 'On' : 'Off'}\` | Filter: \`${filterText}\``;
};
const filterText = Array.isArray(queue.filters) ? queue.filters.join(", ") : "Off"
return `Volume: \`${queue.volume}%\` | Loop: \`${queue.repeatMode ? queue.repeatMode === 2 ? "All Queue" : "This Song" : "Off"}\` | Autoplay: \`${queue.autoplay ? "On" : "Off"}\` | Filter: \`${filterText}\``
}

module.exports = {
data: new SlashCommandBuilder()
.setName('current')
.setDescription('Displays information about the current track is playing')
.setDMPermission(false),
category: 'music',
async execute(interaction) {
const queue = await distube.getQueue(interaction);
const voiceChannelId = interaction.member.voice.channelId;
data: new SlashCommandBuilder()
.setName("current")
.setDescription("Displays information about the current track is playing")
.setDMPermission(false),
category: "music",
async execute (interaction) {
const queue = await distube.getQueue(interaction)
const voiceChannelId = interaction.member.voice.channelId

if (!voiceChannelId) {
return interaction.reply({
content: 'Please join a voice channel first!',
ephemeral: true,
});
}
if (!voiceChannelId) {
return interaction.reply({
content: "Please join a voice channel first!",
ephemeral: true
})
}

const botMember = interaction.guild.members.cache.get(
interaction.client.user.id,
);
const botMember = interaction.guild.members.cache.get(
interaction.client.user.id
)

if (!botMember.voice?.channelId) {
return interaction.reply({
content: 'I am not currently in a voice channel!',
ephemeral: true,
});
}
if (!botMember.voice?.channelId) {
return interaction.reply({
content: "I am not currently in a voice channel!",
ephemeral: true
})
}

const botVoiceChannelId = botMember.voice.channelId;
const botVoiceChannelId = botMember.voice.channelId

if (voiceChannelId !== botVoiceChannelId) {
return interaction.reply({
content:
'You need to be in the same voice channel as the bot to use this command!',
ephemeral: true,
});
}
if (voiceChannelId !== botVoiceChannelId) {
return interaction.reply({
content:
"You need to be in the same voice channel as the bot to use this command!",
ephemeral: true
})
}

if (!queue) {
const queueError = new EmbedBuilder()
.setDescription('There is currently nothing playing!')
.setColor('#FF0000');
if (!queue) {
const queueError = new EmbedBuilder()
.setDescription("There is currently nothing playing!")
.setColor("#FF0000")

return interaction.reply({ embeds: [queueError], ephemeral: true });
}
return interaction.reply({ embeds: [queueError], ephemeral: true })
}

const song = queue.songs[0];
const embed = new EmbedBuilder()
.setColor('#7200FF')
.setAuthor({
name: 'Now Playing',
iconURL:
'https://raw.githubusercontent.com/ballaual/DiCoBo/master/assets/music.gif',
})
.setThumbnail(song.thumbnail)
.setDescription(`[${song.name}](${song.url})`)
.addFields(
{ name: '**Views:**', value: song.views.toString(), inline: true },
{ name: '**Likes:**', value: song.likes.toString(), inline: true },
{ name: '**Duration:**', value: song.formattedDuration.toString(), inline: true },
{ name: '**Status**', value: status(queue).toString() })
.setFooter({ text: `Requested by ${song.user.username}`, iconURL: song.user.avatarURL() })
.setTimestamp();
const song = queue.songs[0]
const embed = new EmbedBuilder()
.setColor("#7200FF")
.setAuthor({
name: "Now Playing",
iconURL:
"https://raw.githubusercontent.com/ballaual/DiCoBo/master/assets/music.gif"
})
.setThumbnail(song.thumbnail)
.setDescription(`[${song.name}](${song.url})`)
.addFields(
{ name: "**Views:**", value: song.views.toString(), inline: true },
{ name: "**Likes:**", value: song.likes.toString(), inline: true },
{ name: "**Duration:**", value: song.formattedDuration.toString(), inline: true },
{ name: "**Status**", value: status(queue).toString() })
.setFooter({ text: `Requested by ${song.user.username}`, iconURL: song.user.avatarURL() })
.setTimestamp()

return interaction.reply({ embeds: [embed] });
},
};
return interaction.reply({ embeds: [embed] })
}
}
61 changes: 30 additions & 31 deletions commands/Music/join.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { joinVoiceChannel } = require('@discordjs/voice');
const { SlashCommandBuilder } = require("@discordjs/builders")
const { joinVoiceChannel } = require("@discordjs/voice")

module.exports = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('The bot joins the users voice channel to play music')
.setDMPermission(false),
category: 'music',
async execute(interaction) {
const voiceChannel = interaction.member.voice.channel;
if (!voiceChannel) {
return interaction.reply({
content: 'Please join a voice channel first!',
ephemeral: true,
});
}
data: new SlashCommandBuilder()
.setName("join")
.setDescription("The bot joins the users voice channel to play music")
.setDMPermission(false),
category: "music",
async execute (interaction) {
const voiceChannel = interaction.member.voice.channel
if (!voiceChannel) {
return interaction.reply({
content: "Please join a voice channel first!",
ephemeral: true
})
}

try {
joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
await interaction.reply(`✅ | ***Successfully joined the voice channel "${voiceChannel.name}"***`);
}
catch (error) {
return interaction.reply({
content: `There was an error connecting to the voice channel: ${error}`,
ephemeral: true,
});
}
},
};
try {
joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator
})
await interaction.reply(`✅ | ***Successfully joined the voice channel "${voiceChannel.name}"***`)
} catch (error) {
return interaction.reply({
content: `There was an error connecting to the voice channel: ${error}`,
ephemeral: true
})
}
}
}
Loading

0 comments on commit cf9879e

Please sign in to comment.