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/commands/eval.js b/commands/eval.js index d98ac1d..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) { + name: 'eval', + 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": [ { diff --git a/commands/info.js b/commands/info.js index 24eeecf..f999f7d 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}`; } 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 } }}); } diff --git a/commands/reload.js b/commands/reload.js index 6f89903..6bd8f2c 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) { + name: 'reload', + description: 'Reloads a command', + 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(), 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 }, }}); } 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 diff --git a/start.js b/start.js index 958cb8c..2c92a2b 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(); @@ -20,11 +20,11 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: { "color": 13632027, "footer": { "icon_url": messageAuthorURL, - "text": footerTxt + "text": config.footerTxt }, "fields": [ { - "name": "Well that happened...", + "name": "Something went wrong!", "value": errorMsg } ] @@ -33,47 +33,48 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: { client.on("error", (e) => console.log(`[ERROR] ${error(e)}`)); client.on("warn", (e) => (`[WARN] ${warn(e)}`)); client.once('ready', () => { - console.clear() - console.log(' ___ _ __ '); - console.log(' / | ____ (_) /__________ _ __'); - 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.clear() + console.log(' ___ _ __ '); + console.log(' / | ____ (_) /__________ _ __'); + console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/'); + console.log(' / ___ |/ / / / / /_/ / / /_/ /> < '); + 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() * 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 command = args.shift().toLowerCase(); - - if (!client.commands.has(command)) return; + const args = message.content.slice(config.prefix.length).split(/ +/); + const command = args.shift().toLowerCase(); + + if (!client.commands.has(command)) return; - try { - await client.commands.get(command).execute(client, message, args, footerTxt); - } catch (error) { - console.stack; - message.channel.send({embed: { - "title": "<:AnitroxError:809651936563429416> **Something went wrong!**", - "description": error.stack, - "color": 13632027, + try { + await client.commands.get(command).execute(client, message, args, config); + } catch (error) { + console.stack; + message.channel.send({embed: { + "title": "<:AnitroxError:809651936563429416> **Something went wrong!**", + "description": error.stack, + "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