diff --git a/.data/youtube.data b/.data/youtube.data new file mode 100644 index 0000000..582657b --- /dev/null +++ b/.data/youtube.data @@ -0,0 +1,12 @@ +{ + "cookie": { + "GPS": "1", + "Domain": ".youtube.com", + "Expires": "Thu, 27-Oct-2022 17:51:25 GMT", + "Path": "/", + "YSC": "AlW2Krsd2Ek", + "SameSite": "none", + "VISITOR_INFO1_LIVE": "_eP8T2zceRQ" + }, + "file": true +} \ No newline at end of file diff --git a/commands/em.mp3 b/commands/em.mp3 new file mode 100644 index 0000000..d637c4c Binary files /dev/null and b/commands/em.mp3 differ diff --git a/commands/playAudio.js b/commands/playAudio.js index 865fedc..8495475 100644 --- a/commands/playAudio.js +++ b/commands/playAudio.js @@ -1,18 +1,97 @@ const pathToFfmpeg = require('ffmpeg-static'); -const { joinVoiceChannel } = require('@discordjs/voice'); +const { joinVoiceChannel, createAudioResource } = require('@discordjs/voice'); const { generateDependencyReport } = require('@discordjs/voice'); -const { VoiceConnectionStatus, AudioPlayerStatus } = require('@discordjs/voice'); +const { VoiceConnectionStatus, AudioPlayerStatus, createAudioPlayer, StreamType } = require('@discordjs/voice'); +const play = require('play-dl'); + +// Leave here to be initialized at the program's start +const player = createAudioPlayer(); + +// Note: Unsure of what this does , but may be related to the play-dl lib (my notes are inconsistent) +// play.authorization(); + module.exports = { name: "playaudio", - execute(message, args, client) { - message.channel.send("This command has not been set up yet\nSorry!"); - return; - // const ytdl = require('ytdl-core-discord'); - // const url = args[0]; + async execute(message, args, bot) { + // message.channel.send("This command has not been set up yet\nSorry!"); + // return; + if (args[0] == "play") { + if (args.length < 1) { + message.reply("Please specify a function (play, pause, unpause or stop)"); + return; + } else if (args.length < 2) { + message.reply("Please provide a song url"); + return; + } + } + + /* + Re-introduce once the issue with ydtl-core is resolved (see + https://github.com/porridgewithraisins/jam-bot#known-bugs) + const stream = await ytdl(url, { filter: 'audioonly' }); + */ + const channel = bot.channels.cache.get("930148609406685227"); + const connection = joinVoiceChannel({ + channelId: channel.id, + guildId: channel.guild.id, + adapterCreator: channel.guild.voiceAdapterCreator, + }); - // async function play(connection, url) { - // connection.playOpusStream(await ytdl(url)); - // } + connection.on(VoiceConnectionStatus.Ready, () => { + console.log('Connected to the voice channel!'); + }); + + if (args[0] == "play") { + let stream; + let info = "Playing __***"; + let yt_info; + if (args[1].startsWith("https://")) { + if (!args[1].startsWith("https://www.youtube.com/") && + !args[1].startsWith("https://music.youtube.com/")) { + message.reply("This is not a valid YouTube URL"); + return; + } + yt_info = await play.video_info(args[1]); + // let stream = await play.stream_from_info(yt_info) + stream = await play.stream(args[1]); + + console.log("Playing from a URL!"); + } else { + yt_info = await play.search(args.slice(1).join(' '), { + limit: 1 + }); + + stream = await play.stream(yt_info[0].url); + yt_info = await play.video_info(yt_info[0].url); + } + + //Add the video info to the return message + info += yt_info.video_details.title + "***__\n"; + info += "Check it out at " + yt_info.video_details.url + "\n"; + + + let resource = createAudioResource(stream.stream, { + inputType: stream.type + }) + + connection.subscribe(player); + + let audio = "em.mp3"; + // let resource = createAudioResource(join(__dirname, audio)); + player.play(resource); + + player.on(AudioPlayerStatus.Playing, () => { + console.log('The audio player has started playing!'); + }); + message.reply(info); + } else if (args[0] == "pause") { + player.pause(); + } else if (args[0] == "unpause") { + player.unpause(); + } else if (args[0] == "stop") { + player.stop(); + connection.destroy(); + } } } \ No newline at end of file diff --git a/main.js b/main.js index e5427b2..33ae124 100644 --- a/main.js +++ b/main.js @@ -3,11 +3,12 @@ const Discord = require('discord.js'); const { token } = require('./commands/currency/config.json'); -const client = new Client({ +const bot = new Client({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, - Intents.FLAGS.GUILD_MESSAGE_REACTIONS + Intents.FLAGS.GUILD_MESSAGE_REACTIONS, + Intents.FLAGS.GUILD_VOICE_STATES ], }); @@ -16,11 +17,11 @@ const prefix = '/'; const fs = require('fs'); const { exit } = require('process'); -client.commands = new Discord.Collection(); +bot.commands = new Discord.Collection(); -client.commNames = new Discord.Collection(); +bot.commNames = new Discord.Collection(); -client.econ = new Discord.Collection(); +bot.econ = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); @@ -30,31 +31,31 @@ let i = 0; for (const file of commandFiles) { const command = require(`./commands/${file}`); - client.commands.set(command.name, command); - client.commNames.set(i, [command.name, command.description]); + bot.commands.set(command.name, command); + bot.commNames.set(i, [command.name, command.description]); i ++; } //ECON SECTION -client.commands.set('ECON', require(`./commands/currency/app.js`)); +bot.commands.set('ECON', require(`./commands/currency/app.js`)); const currency = new Discord.Collection(); const { Users } = require('./commands/currency/dbObjects.js'); i++; -client.commNames.set('length', i); +bot.commNames.set('length', i); -client.on('ready', async () => { - // client.once('ready', async () => { +bot.on('ready', async () => { + // bot.once('ready', async () => { const storedBalances = await Users.findAll(); storedBalances.forEach(b => currency.set(b.user_id, b)); - // console.log(`Logged in as ${client.user.tag}!`); + // console.log(`Logged in as ${bot.user.tag}!`); console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!'); }); -client.on('messageCreate', (message) => { +bot.on('messageCreate', (message) => { //COMMAND AREA //Check if the prefix exists if (!message.content.startsWith(prefix) || message.author.bot) return; @@ -66,38 +67,38 @@ client.on('messageCreate', (message) => { //Check if the user has sufficient permission //Performes the command switch(command) { - case 'test': client.commands.get('Hello World').execute(message, args); + case 'test': bot.commands.get('Hello World').execute(message, args); break; - case 'profile': client.commands.get('profile').execute(message, args, Discord); + case 'profile': bot.commands.get('profile').execute(message, args, Discord); break; - case 'links': client.commands.get('links').execute(message, args, Discord); + case 'links': bot.commands.get('links').execute(message, args, Discord); break; - case 'arrow': client.commands.get('arrow').execute(message, args, Discord); + case 'arrow': bot.commands.get('arrow').execute(message, args, Discord); break; - case 'playaudio': client.commands.get('playaudio').execute(message, args, client, Discord); + case 'playaudio': bot.commands.get('playaudio').execute(message, args, bot, Discord); break; - case 'quotes': client.commands.get('quotes').execute(message, args, Discord, Client); + case 'quotes': bot.commands.get('quotes').execute(message, args, Discord, Client); break; - case 'extracredit': client.commands.get('EC').execute(message); + case 'extracredit': bot.commands.get('EC').execute(message); break; - case 'scrape': client.commands.get('scraper').execute(message, args); + case 'scrape': bot.commands.get('scraper').execute(message, args); break; - case 'kareoke': client.commands.get('kareoke').execute(message, args); + case 'kareoke': bot.commands.get('kareoke').execute(message, args); break; - default: client.commands.get('ECON').execute(client, prefix, message, args, command, Users, currency); + default: bot.commands.get('ECON').execute(bot, prefix, message, args, command, Users, currency); } }) //Last Line -client.login(token); \ No newline at end of file +bot.login(token); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 30b36fa..6aafd3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,10 +15,15 @@ "discord.js": "^13.6.0", "ffmpeg": "^0.0.4", "ffmpeg-static": "^5.0.0", + "libsodium-wrappers": "^0.7.10", "node.js": "^0.0.1-security", + "play-dl": "^1.9.4", "sequelize": "^6.19.0", "sqlite3": "^5.0.3", - "sudo": "^1.0.3" + "sudo": "^1.0.3", + "youtube-mp3-downloader": "^0.7.10", + "ytdl-core": "^4.11.0", + "ytdl-core-discord": "^1.3.1" } }, "node_modules/@derhuerst/http-basic": { @@ -402,6 +407,11 @@ "node": ">= 6" } }, + "node_modules/async": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -658,6 +668,29 @@ "node": ">=16" } }, + "node_modules/fluent-ffmpeg": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz", + "integrity": "sha1-yVLeIkD4EuvaCqgAbXd27irPfXQ=", + "dependencies": { + "async": ">=0.2.9", + "which": "^1.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fluent-ffmpeg/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -884,8 +917,20 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "optional": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/libsodium": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz", + "integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==" + }, + "node_modules/libsodium-wrappers": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz", + "integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==", + "dependencies": { + "libsodium": "^0.7.0" + } }, "node_modules/lodash": { "version": "4.17.21", @@ -903,6 +948,18 @@ "node": ">=10" } }, + "node_modules/m3u8stream": { + "version": "0.8.6", + "resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.6.tgz", + "integrity": "sha512-LZj8kIVf9KCphiHmH7sbFQTVe4tOemb202fWwvJwR9W5ENW/1hxJN6ksAWGhQgSBSa3jyWhnjKU1Fw1GaOdbyA==", + "dependencies": { + "miniget": "^4.2.2", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -971,6 +1028,14 @@ "node": ">= 0.6" } }, + "node_modules/miniget": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/miniget/-/miniget-4.2.2.tgz", + "integrity": "sha512-a7voNL1N5lDMxvTMExOkg+Fq89jM2vY8pAi9ZEWzZtfNmdfP6RXkvUtFnCAXoCv2T9k1v/fUJVaAEuepGcvLYA==", + "engines": { + "node": ">=12" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -1315,6 +1380,22 @@ "node": "*" } }, + "node_modules/play-audio": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.5.2.tgz", + "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==" + }, + "node_modules/play-dl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/play-dl/-/play-dl-1.9.4.tgz", + "integrity": "sha512-/NiD3rpZw/5zbtUhF87AQEmHYLBD5QhtCD/9c3b47xvZMxCO3eHLEN5G1h/b/lC1lCp+xj5BpdYefOrIbDhBUQ==", + "dependencies": { + "play-audio": "^0.5.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -1328,6 +1409,15 @@ "node": ">=0.4.0" } }, + "node_modules/progress-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-2.0.0.tgz", + "integrity": "sha1-+sY6Cz0R3qy7CWmrzJOyFLzhntU=", + "dependencies": { + "speedometer": "~1.0.0", + "through2": "~2.0.3" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -1411,6 +1501,19 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, + "node_modules/sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "node_modules/semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -1539,6 +1642,11 @@ "node": ">= 10" } }, + "node_modules/speedometer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz", + "integrity": "sha1-zWccsGdSwivKM3Di8zREC+T8YuI=" + }, "node_modules/sqlite3": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.3.tgz", @@ -1634,6 +1742,15 @@ "node": ">= 10" } }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, "node_modules/tiny-typed-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", @@ -1649,6 +1766,14 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, "node_modules/ts-mixer": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", @@ -1687,6 +1812,11 @@ "imurmurhash": "^0.1.4" } }, + "node_modules/utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -1783,11 +1913,126 @@ } } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/youtube-mp3-downloader": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/youtube-mp3-downloader/-/youtube-mp3-downloader-0.7.10.tgz", + "integrity": "sha512-ib+DwvlTBQz8o0Ki6wViw/8MZLvYkOWB2zoAtjlYd11fWj3/gCPbCbN8GIra1sZ6tPuE19HICQNBPwGAlU4erw==", + "dependencies": { + "async": "^3.2.2", + "fluent-ffmpeg": "2.1.2", + "progress-stream": "^2.0.0", + "sanitize-filename": "^1.6.3", + "ytdl-core": "^4.9.1" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/ytdl-core": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.11.0.tgz", + "integrity": "sha512-Q3hCLiUA9AOGQXzPvno14GN+HgF9wsO1ZBHlj0COTcyxjIyFpWvMfii0UC4/cAbVaIjEdbWB71GdcGuc4J1Lmw==", + "dependencies": { + "m3u8stream": "^0.8.6", + "miniget": "^4.2.2", + "sax": "^1.1.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ytdl-core-discord": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ytdl-core-discord/-/ytdl-core-discord-1.3.1.tgz", + "integrity": "sha512-KW8zYY35jRSkxZTEQtT9EiR2exFwYKhCE8QZbRg5Ge9a0YWDDhBOixSdWb8Cn41B1uHhz8FR15E4E/k0kHNX3w==", + "dependencies": { + "@types/node": "^15.12.2", + "prism-media": "^1.3.1", + "ytdl-core": "^4.8.2" + } + }, + "node_modules/ytdl-core-discord/node_modules/@discordjs/opus": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.5.3.tgz", + "integrity": "sha512-IQhCwCy2WKXLe+qkOkwO1Wjgk20uqeAbqM62tCbzIqbTsXX4YAge8Me9RFnI77Lx+UTkgm4rSVM3VPVdS/GsUw==", + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "@discordjs/node-pre-gyp": "^0.4.0", + "node-addon-api": "^3.2.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ytdl-core-discord/node_modules/@types/node": { + "version": "15.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.9.tgz", + "integrity": "sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==" + }, + "node_modules/ytdl-core-discord/node_modules/ffmpeg-static": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/ffmpeg-static/-/ffmpeg-static-4.4.1.tgz", + "integrity": "sha512-gyGTIf5kgmLDmH7Rwj8vMmNK46bjXKKofHS2gY+LUqoTe/iybVuTuvnhJQR2tZHlKlDG7A/BIH7cRa2jWDKgWw==", + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "@derhuerst/http-basic": "^8.2.0", + "env-paths": "^2.2.0", + "https-proxy-agent": "^5.0.0", + "progress": "^2.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ytdl-core-discord/node_modules/node-addon-api": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", + "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==", + "optional": true, + "peer": true + }, + "node_modules/ytdl-core-discord/node_modules/prism-media": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz", + "integrity": "sha512-L6UsGHcT6i4wrQhFF1aPK+MNYgjRqR2tUoIqEY+CG1NqVkMjPRKzS37j9f8GiYPlD6wG9ruBj+q5Ax+bH8Ik1g==", + "peerDependencies": { + "@discordjs/opus": "^0.5.0", + "ffmpeg-static": "^4.2.7 || ^3.0.0 || ^2.4.0", + "node-opus": "^0.3.3", + "opusscript": "^0.0.8" + }, + "peerDependenciesMeta": { + "@discordjs/opus": { + "optional": true + }, + "ffmpeg-static": { + "optional": true + }, + "node-opus": { + "optional": true + }, + "opusscript": { + "optional": true + } + } + }, "node_modules/zod": { "version": "3.14.4", "resolved": "https://registry.npmjs.org/zod/-/zod-3.14.4.tgz", @@ -2092,6 +2337,11 @@ } } }, + "async": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2296,6 +2546,25 @@ "progress": "^2.0.3" } }, + "fluent-ffmpeg": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz", + "integrity": "sha1-yVLeIkD4EuvaCqgAbXd27irPfXQ=", + "requires": { + "async": ">=0.2.9", + "which": "^1.1.1" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -2485,8 +2754,20 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "optional": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "libsodium": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz", + "integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==" + }, + "libsodium-wrappers": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz", + "integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==", + "requires": { + "libsodium": "^0.7.0" + } }, "lodash": { "version": "4.17.21", @@ -2501,6 +2782,15 @@ "yallist": "^4.0.0" } }, + "m3u8stream": { + "version": "0.8.6", + "resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.6.tgz", + "integrity": "sha512-LZj8kIVf9KCphiHmH7sbFQTVe4tOemb202fWwvJwR9W5ENW/1hxJN6ksAWGhQgSBSa3jyWhnjKU1Fw1GaOdbyA==", + "requires": { + "miniget": "^4.2.2", + "sax": "^1.2.4" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2553,6 +2843,11 @@ "mime-db": "1.52.0" } }, + "miniget": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/miniget/-/miniget-4.2.2.tgz", + "integrity": "sha512-a7voNL1N5lDMxvTMExOkg+Fq89jM2vY8pAi9ZEWzZtfNmdfP6RXkvUtFnCAXoCv2T9k1v/fUJVaAEuepGcvLYA==" + }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2808,6 +3103,19 @@ "resolved": "https://registry.npmjs.org/pidof/-/pidof-1.0.2.tgz", "integrity": "sha1-+6Dq4cgzWhHrgJn10PPvvEXLTpA=" }, + "play-audio": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.5.2.tgz", + "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==" + }, + "play-dl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/play-dl/-/play-dl-1.9.4.tgz", + "integrity": "sha512-/NiD3rpZw/5zbtUhF87AQEmHYLBD5QhtCD/9c3b47xvZMxCO3eHLEN5G1h/b/lC1lCp+xj5BpdYefOrIbDhBUQ==", + "requires": { + "play-audio": "^0.5.2" + } + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -2818,6 +3126,15 @@ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" }, + "progress-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-2.0.0.tgz", + "integrity": "sha1-+sY6Cz0R3qy7CWmrzJOyFLzhntU=", + "requires": { + "speedometer": "~1.0.0", + "through2": "~2.0.3" + } + }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -2886,6 +3203,19 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -2959,6 +3289,11 @@ "socks": "^2.6.1" } }, + "speedometer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz", + "integrity": "sha1-zWccsGdSwivKM3Di8zREC+T8YuI=" + }, "sqlite3": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.3.tgz", @@ -3028,6 +3363,15 @@ "yallist": "^4.0.0" } }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, "tiny-typed-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", @@ -3043,6 +3387,14 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", + "requires": { + "utf8-byte-length": "^1.0.1" + } + }, "ts-mixer": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", @@ -3081,6 +3433,11 @@ "imurmurhash": "^0.1.4" } }, + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -3151,11 +3508,92 @@ "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", "requires": {} }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "youtube-mp3-downloader": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/youtube-mp3-downloader/-/youtube-mp3-downloader-0.7.10.tgz", + "integrity": "sha512-ib+DwvlTBQz8o0Ki6wViw/8MZLvYkOWB2zoAtjlYd11fWj3/gCPbCbN8GIra1sZ6tPuE19HICQNBPwGAlU4erw==", + "requires": { + "async": "^3.2.2", + "fluent-ffmpeg": "2.1.2", + "progress-stream": "^2.0.0", + "sanitize-filename": "^1.6.3", + "ytdl-core": "^4.9.1" + } + }, + "ytdl-core": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.11.0.tgz", + "integrity": "sha512-Q3hCLiUA9AOGQXzPvno14GN+HgF9wsO1ZBHlj0COTcyxjIyFpWvMfii0UC4/cAbVaIjEdbWB71GdcGuc4J1Lmw==", + "requires": { + "m3u8stream": "^0.8.6", + "miniget": "^4.2.2", + "sax": "^1.1.3" + } + }, + "ytdl-core-discord": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ytdl-core-discord/-/ytdl-core-discord-1.3.1.tgz", + "integrity": "sha512-KW8zYY35jRSkxZTEQtT9EiR2exFwYKhCE8QZbRg5Ge9a0YWDDhBOixSdWb8Cn41B1uHhz8FR15E4E/k0kHNX3w==", + "requires": { + "@types/node": "^15.12.2", + "prism-media": "^1.3.1", + "ytdl-core": "^4.8.2" + }, + "dependencies": { + "@discordjs/opus": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.5.3.tgz", + "integrity": "sha512-IQhCwCy2WKXLe+qkOkwO1Wjgk20uqeAbqM62tCbzIqbTsXX4YAge8Me9RFnI77Lx+UTkgm4rSVM3VPVdS/GsUw==", + "optional": true, + "peer": true, + "requires": { + "@discordjs/node-pre-gyp": "^0.4.0", + "node-addon-api": "^3.2.1" + } + }, + "@types/node": { + "version": "15.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.9.tgz", + "integrity": "sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==" + }, + "ffmpeg-static": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/ffmpeg-static/-/ffmpeg-static-4.4.1.tgz", + "integrity": "sha512-gyGTIf5kgmLDmH7Rwj8vMmNK46bjXKKofHS2gY+LUqoTe/iybVuTuvnhJQR2tZHlKlDG7A/BIH7cRa2jWDKgWw==", + "optional": true, + "peer": true, + "requires": { + "@derhuerst/http-basic": "^8.2.0", + "env-paths": "^2.2.0", + "https-proxy-agent": "^5.0.0", + "progress": "^2.0.3" + } + }, + "node-addon-api": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", + "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==", + "optional": true, + "peer": true + }, + "prism-media": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz", + "integrity": "sha512-L6UsGHcT6i4wrQhFF1aPK+MNYgjRqR2tUoIqEY+CG1NqVkMjPRKzS37j9f8GiYPlD6wG9ruBj+q5Ax+bH8Ik1g==", + "requires": {} + } + } + }, "zod": { "version": "3.14.4", "resolved": "https://registry.npmjs.org/zod/-/zod-3.14.4.tgz", diff --git a/package.json b/package.json index d35eecd..96028b4 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,15 @@ "discord.js": "^13.6.0", "ffmpeg": "^0.0.4", "ffmpeg-static": "^5.0.0", + "libsodium-wrappers": "^0.7.10", "node.js": "^0.0.1-security", + "play-dl": "^1.9.4", "sequelize": "^6.19.0", "sqlite3": "^5.0.3", - "sudo": "^1.0.3" + "sudo": "^1.0.3", + "youtube-mp3-downloader": "^0.7.10", + "ytdl-core": "^4.11.0", + "ytdl-core-discord": "^1.3.1" }, "name": "selmerbot", "description": "Authors: ION606, MajorDrools",