forked from Paris-Developers/Mirror-TS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClearQueue.ts
43 lines (41 loc) · 1.37 KB
/
ClearQueue.ts
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
import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
MessageEmbed,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
import { colorCheck } from '../resources/embedColorCheck';
import { SlashCommand } from './SlashCommand';
export class ClearQueue implements SlashCommand {
name: string = 'clearqueue';
description = 'Clear the music queue';
options = [];
requiredPermissions: bigint[] = [];
run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
embed.setDescription(
'There are no songs in the queue or the player is not playing'
);
return interaction.reply({ embeds: [embed], ephemeral: true });
}
queue.clear();
embed.setDescription(`Queue has been cleared by ${interaction.user}`);
return interaction.reply({ embeds: [embed] });
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
return interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;
}