-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.js
44 lines (35 loc) · 1.37 KB
/
stop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { EmbedBuilder } = require('discord.js');
const config = require("../config.js");
async function stop(client, interaction) {
try {
const player = client.riffy.players.get(interaction.guildId);
if (!player) {
const errorEmbed = new EmbedBuilder()
.setColor('#ff0000')
.setTitle('Error')
.setDescription('❌ No active player found.');
await interaction.reply({ embeds: [errorEmbed], ephemeral: true });
return;
}
player.stop();
player.destroy();
const embed = new EmbedBuilder()
.setColor(config.embedColor)
.setDescription('**⏹️ Playback has been stopped and player destroyed!**');
await interaction.reply({ embeds: [embed] });
} catch (error) {
console.error('Error processing stop command:', error);
const errorEmbed = new EmbedBuilder()
.setColor('#ff0000')
.setTitle('Error')
.setDescription('❌ An error occurred while processing your request.');
await interaction.reply({ embeds: [errorEmbed], ephemeral: true });
}
}
module.exports = {
name: "stop",
description: "Stop the current song and destroy the player",
permissions: "0x0000000000000800",
options: [],
run: stop
};