UNPKG

@halpz/fetch

Version:

discordbot commands using js

26 lines (20 loc) 587 B
const { CommandInteraction, EmbedBuilder } = require('discord.js'); module.exports = shuffling /** * * * @param {CommandInteraction} interaction */ async function shuffling(client, interaction) { var array = client.ctrack[interaction.guildId]; for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } client.ctrack[interaction.guildId] = array; return [ new EmbedBuilder() .setColor(client.get_color()) .setTitle(`Your queue has been shuffled`) ] }