From 88ac2d4ab0bb014b17a65258550fa8f8cb575912 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Sun, 27 Mar 2022 20:08:50 -0500 Subject: [PATCH 1/8] Fix uptimes returning with everything in days --- commands/info.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/info.js b/commands/info.js index a58b9d5..e0ee274 100644 --- a/commands/info.js +++ b/commands/info.js @@ -14,10 +14,10 @@ module.exports = { const minutes = parseInt((totalSeconds % 3600) / 60); const seconds = parseInt(totalSeconds % 60); - const daystring = days + (days === 1 ? "day" : "days"); - const hourstring = hours + (hours === 1 ? "day" : "days"); - const minutetring = minutes + (minutes === 1 ? "day" : "days"); - const secondstring = seconds + (seconds === 1 ? "day" : "days"); + const daystring = days + (days === 1 ? " day" : " days"); + const hourstring = hours + (hours === 1 ? " hour" : " hours"); + const minutetring = minutes + (minutes === 1 ? " minute" : " minutes"); + const secondstring = seconds + (seconds === 1 ? " second" : " seconds"); return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`; } From 976ba50c38340c4921a72fb74b399bba93f6df75 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 10:56:21 -0500 Subject: [PATCH 2/8] Move config to a single variable and pass it. --- start.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/start.js b/start.js index 117f0c0..b63d7f7 100755 --- a/start.js +++ b/start.js @@ -2,8 +2,8 @@ const fs = require('fs'); const Discord = require('discord.js'); -const { statuses, build, release, prefix, token, footerTxt } = require('./config.json'); - +// const { statuses, build, release, prefix, token, footerTxt } = require('./config.json'); +const config = require('./config.json'); console.log('Starting!') const client = new Discord.Client(); client.commands = new Discord.Collection(); @@ -24,7 +24,7 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: { }, "fields": [ { - "name": "Well that happened...", + "name": "Something went wrong!", "value": errorMsg } ] @@ -39,14 +39,14 @@ client.once('ready', () => { console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/'); console.log(' / ___ |/ / / / / /_/ / / /_/ /> < '); console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| '); - console.log(`${release}, ${build}`); - console.log("All Systems Go. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!"); + console.log(`${config.release}, ${config.build}`); + console.log("Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!"); }); setInterval(async () => { // Picks a status from the config file - const index = Math.floor(Math.random() * statuses.length); + const index = Math.floor(Math.random() * config.statuses.length); await client.user.setActivity(statuses[index]); }, 20000); @@ -61,7 +61,7 @@ client.on('message', async (message) => { if (!client.commands.has(command)) return; try { - await client.commands.get(command).execute(client, message, args, footerTxt); + await client.commands.get(command).execute(client, message, args, config); } catch (error) { console.stack; message.channel.send({embed: { @@ -70,10 +70,10 @@ client.on('message', async (message) => { "color": 13632027, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, }}); } }); -client.login(token); \ No newline at end of file +client.login(config.token); \ No newline at end of file From 268ceb9c4aab213ef0d415f3f4dfbcaa699ab95c Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 12:39:27 -0500 Subject: [PATCH 3/8] Move everything to use config --- start.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/start.js b/start.js index b63d7f7..8ea0b95 100755 --- a/start.js +++ b/start.js @@ -20,7 +20,7 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: { "color": 13632027, "footer": { "icon_url": messageAuthorURL, - "text": footerTxt + "text": config.footerTxt }, "fields": [ { @@ -41,21 +41,22 @@ client.once('ready', () => { console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| '); console.log(`${config.release}, ${config.build}`); console.log("Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!"); + // Statuses + setInterval(async () => { + // Picks a status from the config file + const index = Math.floor(Math.random() * config.statuses.length); + await client.user.setActivity(config.statuses[index]); + }, 20000); + }); -setInterval(async () => { - // Picks a status from the config file - const index = Math.floor(Math.random() * config.statuses.length); - await client.user.setActivity(statuses[index]); -}, 20000); - // Begin Command Handler client.on('message', async (message) => { - if (!message.content.startsWith(prefix) || message.author.bot) return; + if (!message.content.startsWith(config.prefix) || message.author.bot) return; - const args = message.content.slice(prefix.length).split(/ +/); + const args = message.content.slice(config.prefix.length).split(/ +/); const command = args.shift().toLowerCase(); if (!client.commands.has(command)) return; From 55be4eb4f8a71a7a646e0f8a518e1e9644e72141 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 12:42:09 -0500 Subject: [PATCH 4/8] Stop should now end the process --- commands/stop.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/commands/stop.js b/commands/stop.js index a106573..95188bc 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -1,26 +1,27 @@ module.exports = { name: "stop", - description: "Stops the bot", - async execute(client, message, _, footerTxt) { - if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { + description: "IT'S TIME TO STOP!... the bot", + async execute(client, message, config) { + if (message.author.id == config.ownerID) { await message.channel.send({embed: { "title": " **Shutting Down...**", "description": "See you next time!", "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, }}); - client.destroy(); + console.log("The bot is shutting down! Bye bye!") + process.exit(); } else { await message.channel.send({embed: { - "title": ":AnitroxDenied: Access Denied", + "title": "<:AnitroxDenied:809651936642203668> 403 Forbidden", "description": "You need to be the bot owner to execute this command!", "color": 13632027, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, }}); } From 3b33f51c65097fb9d470493d549491563e5daf58 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 13:05:34 -0500 Subject: [PATCH 5/8] Change icons and switch to using config for ID --- commands/reload.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/reload.js b/commands/reload.js index b04dbba..f91bbb8 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -1,8 +1,8 @@ module.exports = { name: 'reload', description: 'Reloads a command', - async execute(client, message, args, footerTxt) { - if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { + async execute(client, message, args, config) { + if (message.author.id = config.ownerID) { if (!args.length) { await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock",message.author.displayAvatarURL())); } @@ -19,7 +19,7 @@ module.exports = { try { const newCommand = require(`./${command.name}.js`); client.commands.set(newCommand.name, newCommand); - await message.channel.send(`<:NyabotSuccess:697211376740859914> **Reloaded \`${command.name}\` successfully!**`); + await message.channel.send(`<:AnitroxSuccess:809651936819019796> **Reloaded \`${command.name}\` successfully!**`); console.log(`User reloaded ${command.name}.`) } catch (error) { console.error(error); @@ -30,7 +30,7 @@ module.exports = { } else { message.channel.send({embed: { - "title": "<:NyabotDenied:697145462565896194> **Access is denied**", + "title": "<:AnitroxDenied:809651936642203668> **403 Forbidden**", "color": 13632027, "footer": { "icon_url": message.author.displayAvatarURL(), From e861e702c0233044746b7a22e69b4bdcc1f7a513 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 13:06:41 -0500 Subject: [PATCH 6/8] Change to using config for ID --- commands/eval.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/commands/eval.js b/commands/eval.js index b94dde9..1b0983c 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,22 +1,21 @@ const { inspect } = require("util"); - module.exports = { name: 'eval', - description: 'Runs js code', - async execute(_, message, args, footerTxt) { - if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { + description: 'Executes JS code', + async execute(_, message, args, config) { + if (message.author.id == config.ownerID) { try { const code = args.join(" "); const evaled = inspect(eval(code)); await message.channel.send(evaled, {code:"xl"}); } catch (error) { await message.channel.send({embed: { - "title": "<:NyabotError:697145462347661412> **Well that happened...**", + "title": "<:AnitroxError:809651936563429416> **Something went wrong! **", "color": 13632027, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "fields": [ { From 9eb8bd3d355072b527938fc57da3e353c2022ca5 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 28 Mar 2022 23:55:13 -0500 Subject: [PATCH 7/8] Change how it gets locations from config --- commands/ping.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/commands/ping.js b/commands/ping.js index 32c097a..b12e186 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,19 +1,17 @@ -const { locations } = require('../config.json'); - module.exports = { name: "ping", description: "Gets bot ping", - async execute(client, message, _, footerTxt) { - const index = Math.floor(Math.random() * locations.length); - const pingLocation = locations[index] + async execute(client, message, args, config) { + const index = Math.floor(Math.random() * config.locations.length); + const location = config.locations[index] await message.channel.send({embed:{ "title": ":ping_pong: Ping", - "description": `**Pong!** We pinged **${pingLocation}** and got ${client.ws.ping} ms.`, + "description": `**Pong!** We pinged **${location}** and got ${client.ws.ping} ms.`, "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt } }}); } From f5f9cdf0e2c5d1132010170c0fcd7182e33e1bd5 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Tue, 29 Mar 2022 11:06:04 -0500 Subject: [PATCH 8/8] Move answers to config JSON --- commands/8ball.js | 36 ++++++++---------------------------- config-example.json | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/commands/8ball.js b/commands/8ball.js index c514b2e..cd58d94 100644 --- a/commands/8ball.js +++ b/commands/8ball.js @@ -1,47 +1,27 @@ -const answers = [ - "Heck no!", - "Are you crazy!? No!", - "Don't even think about it.", - "No! You might bork something!", - "Heck yeah", - "I don't think so.", - "Let me think about it first. No.", - "Let me think about it first. Yeah", - "Let me think about it first. Maybe", - "I don't know man", - "Maybe", - "I'm not sure", - "Ask again", - "YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!", - "Definitely!", - "Go for it! :smile:", - "Good idea!", - "Sure" -] - module.exports = { name: '8ball', description: 'Ask Anitrox a question, any question! and they will answer it!', syntax: ["[Question]"], - async execute(client, message, args, footerTxt) { - const answer = answers[Math.floor(Math.random() * Object.keys(answers).length)]; + async execute(client, message, args, config) { + const index = Math.floor(Math.random() * config.answers.length); + const answer = config.answers[index] const question = args.slice(0).join(" ") if (!question) { await message.channel.send(client.generateErrorMessage("You need to ask a question!", message.author.displayAvatarURL)); } else { await message.channel.send({embed: { - "title": ":8ball: Anitrox 8 Ball", - "description": `Your question: **${question}**`, + "title": ":8ball: 8Ball", + "description": `Your amazing question: **${question}**`, "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "fields": [ { - "name": "🤔 My Answer", - "value": answer + "name": "Answer", + "value": `${answer}` } ] }}); diff --git a/config-example.json b/config-example.json index e8786e6..47afd8f 100644 --- a/config-example.json +++ b/config-example.json @@ -21,17 +21,37 @@ "VLC Media Player", "Chromium" ], - "locations": [ - "Microsoft", - "LinusTechTips", - "Linus Torvalds", - "borkeonv2", - "Google", - "192.168.1.1", - "127.0.0.1", - "Sophie's computer", - "Mars", - "Elon Musk", - "TMC Software" + "locations": [ + "Microsoft", + "LinusTechTips", + "Linus Torvalds", + "borkeonv2", + "Google", + "192.168.1.1", + "127.0.0.1", + "Sophie's computer", + "Mars", + "Elon Musk", + "TMC Software" + ], + "answers": [ + "Heck no!", + "Are you crazy!? No!", + "Don't even think about it.", + "No! You might bork something!", + "Heck yeah", + "I don't think so.", + "Let me think about it first. No.", + "Let me think about it first. Yeah", + "Let me think about it first. Maybe", + "I don't know man", + "Maybe", + "I'm not sure", + "Ask again", + "YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!", + "Definitely!", + "Go for it! :smile:", + "Good idea!", + "Sure" ] } \ No newline at end of file