nyx/unused/commands/Music/grab.js

56 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-10-26 12:38:28 +02:00
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "grab",
description: "Saves the current song to your Direct Messages",
run: async (client, interaction, args, utils) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
try {
2022-10-26 12:38:28 +02:00
const embed = new EmbedBuilder()
.setAuthor(
`Song saved: `,
"https://cdn.discordapp.com/emojis/897017864085712936.gif"
)
.setThumbnail(
`https://img.youtube.com/vi/${player.queue.current.identifier}/mqdefault.jpg`
)
.setURL(player.queue.current.uri)
.setColor(client.color)
.setTimestamp()
.setTitle(`**${player.queue.current.title}**`)
.addField(
`⌛ Duration: `,
`\`${utils.prettyMs(player.queue.current.duration, {
colonNotation: true,
})}\``,
true
)
.addField(`🎵 Author: `, `\`${player.queue.current.author}\``, true)
.addField(`▶ Play it:`, `\`${player.queue.current.uri}\``)
.addField(`🔎 Saved in:`, `<#${interaction.channel.id}>`)
2022-10-26 12:38:28 +02:00
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
});
interaction.user.send({ embeds: [embed] });
} catch (e) {
console.log(e);
return client.err(interaction, "**Your DM are disabled**");
}
client.se(interaction, "✅ | **Check your DM**");
},
};