-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathleave.js
67 lines (63 loc) · 2.21 KB
/
leave.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "stop",
description: "Stop the music and leave the voice channel",
usage: "",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
aliases: ["leave", "exit", "quit", "dc", "disconnect"],
/**
*
* @param {import("../structures/DiscordMusicBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, message, args, { GuildDB }) => {
let player = await client.Manager.get(message.guild.id);
if (!message.member.voice.channel) return client.sendTime(message.channel, "❌ | **You must be in a voice channel to play something!**");
if (!player) return client.sendTime(message.channel,"❌ | **Nothing is playing right now...**");
await client.sendTime(message.channel,":notes: | **The player has stopped and the queue has been cleared.**");
await message.react("✅");
player.destroy();
},
SlashCommand: {
/**
*
* @param {import("../structures/DiscordMusicBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
const guild = client.guilds.cache.get(interaction.guild_id);
const member = guild.members.cache.get(interaction.member.user.id);
if (!member.voice.channel)
return client.sendTime(
interaction,
"❌ | **You must be in a voice channel to use this command.**"
);
if (
guild.me.voice.channel &&
!guild.me.voice.channel.equals(member.voice.channel)
)
return client.sendTime(
interaction,
`❌ | **You must be in ${guild.me.voice.channel} to use this command.**`
);
let player = await client.Manager.get(interaction.guild_id);
if (!player)
return client.sendTime(
interaction,
"❌ | **Nothing is playing right now...**"
);
player.destroy();
client.sendTime(
interaction,
":notes: | **The player has stopped and the queue has been cleared.**"
);
},
},
};