-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const f = require('../functions.js'); | ||
const discord = require('discord.js'); | ||
const fs = require("fs") | ||
|
||
module.exports = { | ||
name: 'shuffle', | ||
description: f.localization("commands","shuffle","exports").description, | ||
category: 'music', | ||
modcommand: false, | ||
usage: f.localization("commands","shuffle","exports").usage, | ||
perms: '', | ||
alias: [], | ||
cooldown: 1, | ||
run: function (message, prefix, args, client) { | ||
const serverQueue = queue.get(message.channel.guild.id); | ||
const channel = message.member.voice.channel | ||
|
||
if (!serverQueue) return message.reply("Ich bin nicht Verbunden.") | ||
if (!serverQueue.playing) return message.reply("Ich spiele aktuell nichst.") | ||
|
||
if (message.member.voice.channel.id != queue.get(message.channel.guild.id).voiceChannel.id) return message.reply("Du musst mit dem Bot in einem Sprachkanal sein."); | ||
|
||
function shuffleArray(array) { | ||
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]]; | ||
} | ||
} | ||
|
||
|
||
let curSong = serverQueue.songs.splice(0, 1)[0] | ||
let newArray = serverQueue.songs | ||
shuffleArray(newArray) | ||
newArray.splice(0, 0, curSong) | ||
serverQueue.songs = newArray; | ||
queue.set(message.guild.id, serverQueue) | ||
message.reply("Die Songliste wurde gemischt."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters