-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,482 additions
and
1,494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}\`` | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) | ||
} | ||
} | ||
} |
Oops, something went wrong.