From 6b8154ba82c8089bcb47e2d3b6fea66353ba27bc Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 10 Jul 2022 17:20:37 -0400 Subject: Fixed an issue where it doesn't shuffle properly --- bot.js | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'bot.js') diff --git a/bot.js b/bot.js index 5aee843..a8958df 100644 --- a/bot.js +++ b/bot.js @@ -21,44 +21,15 @@ import { Client, MessageEmbed, Collection, version } from 'discord.js'; import { voiceInit } from './AudioBackend.js'; import { readdirSync, readFileSync } from 'node:fs'; +import { webServer } from './WebStream.js'; // import config from './config.json' assert { type: 'json' } Not supported by ESLint yet -import { createServer } from 'node:http'; const config = JSON.parse(readFileSync('./config.json')); const bot = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'] }); -const port = 1337; +bot.login(config.token); -const server = createServer((req, res) => { - let body = '{"test": "test"}'; - // Get the data as utf8 strings. - // If an encoding is not set, Buffer objects will be received. - req.setEncoding('utf8'); - - // Readable streams emit 'data' events once a listener is added. - req.on('data', (chunk) => { - body += chunk; - }); - - // The 'end' event indicates that the entire body has been received. - req.on('end', () => { - try { - const data = JSON.parse(body); - // Write back something interesting to the user: - res.write(typeof data); - res.end(); - } catch (er) { - // uh oh! bad json! - res.statusCode = 400; - return res.end(`error: ${er.message}`); - } - }); -}); - -server.listen(port); -console.log(`Web server started! Port: ${port}`); - -// bot.login(config.token); +// webServer(); /** * Project Ideas: -- cgit v1.2.3