-
-
Notifications
You must be signed in to change notification settings - Fork 308
/
shuffle.js
106 lines (101 loc) · 3.16 KB
/
shuffle.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const {
MessageEmbed,
Message
} = require("discord.js");
const config = require("../../botconfig/config.json");
const ee = require("../../botconfig/embed.json");
const settings = require("../../botconfig/settings.json");
const {
check_if_dj
} = require("../../handlers/functions")
module.exports = {
name: "shuffle", //the command name for the Slash Command
category: "Queue",
aliases: ["mix"],
usage: "shuffle",
description: "Shuffles (Mixes) The Queue", //the command description for Slash Command Overview
cooldown: 10,
requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL]
alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL]
run: async (client, message, args) => {
try {
//things u can directly access in an interaction!
const {
member,
channelId,
guildId,
applicationId,
commandName,
deferred,
replied,
ephemeral,
options,
id,
createdTimestamp
} = message;
const {
guild
} = member;
const {
channel
} = member.voice;
if (!channel) return message.reply({
embeds: [
new MessageEmbed().setColor(ee.wrongcolor).setTitle(`${client.allEmojis.x} **Please join ${guild.me.voice.channel ? "__my__" : "a"} VoiceChannel First!**`)
],
})
if (channel.guild.me.voice.channel && channel.guild.me.voice.channel.id != channel.id) {
return message.reply({
embeds: [new MessageEmbed()
.setColor(ee.wrongcolor)
.setFooter(ee.footertext, ee.footericon)
.setTitle(`${client.allEmojis.x} Join __my__ Voice Channel!`)
.setDescription(`<#${guild.me.voice.channel.id}>`)
],
});
}
try {
let newQueue = client.distube.getQueue(guildId);
if (!newQueue || !newQueue.songs || newQueue.songs.length == 0) return message.reply({
embeds: [
new MessageEmbed().setColor(ee.wrongcolor).setTitle(`${client.allEmojis.x} **I am nothing Playing right now!**`)
],
})
if (check_if_dj(client, member, newQueue.songs[0])) {
return message.reply({
embeds: [new MessageEmbed()
.setColor(ee.wrongcolor)
.setFooter(ee.footertext, ee.footericon)
.setTitle(`${client.allEmojis.x} **You are not a DJ and not the Song Requester!**`)
.setDescription(`**DJ-ROLES:**\n> ${check_if_dj(client, member, newQueue.songs[0])}`)
],
});
}
await newQueue.shuffle(volume);
message.reply({
content: `🔀 **Suffled ${newQueue.songs.length} Songs!**\n> 💢 **Action by**: \`${member.user.tag}\``
})
} catch (e) {
console.log(e.stack ? e.stack : e)
message.reply({
content: `${client.allEmojis.x} | Error: `,
embeds: [
new MessageEmbed().setColor(ee.wrongcolor)
.setDescription(`\`\`\`${e}\`\`\``)
],
})
}
} catch (e) {
console.log(String(e.stack).bgRed)
}
}
}
/**
* @INFO
* Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template
* @INFO
* Work for Milrato Development | https://milrato.eu
* @INFO
* Please mention Him / Milrato Development, when using this Code!
* @INFO
*/