const {Collection} = require("oceanic.js"); const { AudioPlayerStatus, StreamType, createAudioPlayer, createAudioResource, } = require("@discordjs/voice"); const playdl = require("play-dl"); const ffprobe = require("node-ffprobe"); const Command = require("../lib/command.js"); const {formatTime, selectionMessage} = require("../lib/utils.js"); const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/; const REGEX_YOUTUBE_PLAYLIST = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/playlist\?list=(.+)$/; const REGEX_YOUTUBE_PLAYLIST_SHORT = /^PL[a-zA-Z0-9-_]{1,32}$/; const REGEX_SOUNDCLOUD = /^((https?:\/\/)?(www\.|m\.)?soundcloud\.com\/|sc:).+\/.+$/; const REGEX_SOUNDCLOUD_PLAYLIST = /^((https?:\/\/)?(www\.|m\.)?soundcloud\.com\/|sc:).+\/(sets\/.+|likes|tracks)$/; const REGEX_FILE = /^(https?:\/\/)?.*\..*\/.+\.(mp3|ogg|flac|wav|webm|mp4|mov|mkv|mod|s3m|it|xm)$/; let SOUNDCLOUD_CLIENTID; hf.voiceStorage = hf.voiceStorage || new Collection(); const voiceStorage = hf.voiceStorage; // https://stackoverflow.com/a/12646864 § "Updating to ES6 / ECMAScript 2015" 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]]; } } async function getSoundcloudClientID() { if (SOUNDCLOUD_CLIENTID != null) { return SOUNDCLOUD_CLIENTID; } const page = await fetch("https://soundcloud.com").then((res) => res.text()); const scripts = page .match(/