From 2206af796acf01d950a0ca87dd2c61bc9eb1d28b Mon Sep 17 00:00:00 2001 From: Nathaniel Mason Date: Sun, 27 Mar 2022 23:03:17 +0100 Subject: [PATCH 1/3] change all indentation to spaces --- commands/eval.js | 8 +++---- commands/info.js | 6 +++--- commands/invite.js | 10 ++++----- commands/reload.js | 12 +++++------ start.js | 54 +++++++++++++++++++++++----------------------- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/commands/eval.js b/commands/eval.js index b94dde9..d98ac1d 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -2,10 +2,10 @@ 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: 'Runs js code', + async execute(_, message, args, footerTxt) { + if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { try { const code = args.join(" "); const evaled = inspect(eval(code)); diff --git a/commands/info.js b/commands/info.js index a58b9d5..24eeecf 100644 --- a/commands/info.js +++ b/commands/info.js @@ -2,9 +2,9 @@ const {build, release} = require('../config.json'); module.exports = { - name: 'info', - description: 'Shows bot and host information', - async execute(client, message, _, footerTxt) { + name: 'info', + description: 'Shows bot and host information', + async execute(client, message, _, footerTxt) { function Uptime(uptime) { const totalSeconds = (uptime / 1000); diff --git a/commands/invite.js b/commands/invite.js index ce04d12..609357c 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -1,9 +1,9 @@ module.exports = { - name: 'invite', - description: 'Add Anitrox to your beautiful server!', - syntax: [], - async execute(_0, message, _1, footerTxt) { + name: 'invite', + description: 'Add Anitrox to your beautiful server!', + syntax: [], + async execute(_0, message, _1, footerTxt) { await message.channel.send({embed: { "title": "Add Anitrox to your Server!", "description": "Weather you want stable, or that squeaky clean fresh PTB build, we gotchu.", @@ -30,5 +30,5 @@ module.exports = { } ] }}); - }, + }, }; \ No newline at end of file diff --git a/commands/reload.js b/commands/reload.js index b04dbba..6f89903 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, footerTxt) { + if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { if (!args.length) { await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock",message.author.displayAvatarURL())); } @@ -43,6 +43,6 @@ module.exports = { } ] }}); - } - } + } + } }; \ No newline at end of file diff --git a/start.js b/start.js index 117f0c0..958cb8c 100755 --- a/start.js +++ b/start.js @@ -11,8 +11,8 @@ client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); for (const file of commandFiles) { - const command = require(`./commands/${file}`); - client.commands.set(command.name, command); + const command = require(`./commands/${file}`); + client.commands.set(command.name, command); } client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: { @@ -33,47 +33,47 @@ 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(`${release}, ${build}`); + console.log("All Systems Go. | 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); - await client.user.setActivity(statuses[index]); + 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(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(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, footerTxt); + } 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 }, - }}); - } + }}); + } }); client.login(token); \ No newline at end of file From 4312a2e0757da63f25c8a51c1bc3ba7545e4286f Mon Sep 17 00:00:00 2001 From: Nathaniel Mason Date: Tue, 29 Mar 2022 19:51:43 +0100 Subject: [PATCH 2/3] change footerTxt to config.footerTxt --- commands/avatar.js | 4 ++-- commands/bonk.js | 4 ++-- commands/cheese.js | 4 ++-- commands/cuddle.js | 4 ++-- commands/help.js | 4 ++-- commands/hug.js | 4 ++-- commands/info.js | 4 ++-- commands/invite.js | 4 ++-- commands/kiss.js | 4 ++-- commands/leskiss.js | 4 ++-- commands/lick.js | 4 ++-- commands/nom.js | 4 ++-- commands/opensource.js | 4 ++-- commands/pat.js | 4 ++-- commands/ping.js | 2 +- commands/poke.js | 4 ++-- commands/reload.js | 2 +- commands/setnick.js | 4 ++-- commands/slap.js | 4 ++-- commands/snuggle.js | 4 ++-- commands/uinfo.js | 4 ++-- start.js | 1 - 22 files changed, 40 insertions(+), 41 deletions(-) diff --git a/commands/avatar.js b/commands/avatar.js index 5db6668..356265b 100644 --- a/commands/avatar.js +++ b/commands/avatar.js @@ -2,7 +2,7 @@ module.exports = { name: "avatar", description: "Gets a user's avatar.", - async execute(client, message, args, footerTxt) { + async execute(client, message, args, config) { const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author; @@ -11,7 +11,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": user.displayAvatarURL() diff --git a/commands/bonk.js b/commands/bonk.js index ab0a7c4..d4d984c 100644 --- a/commands/bonk.js +++ b/commands/bonk.js @@ -2,7 +2,7 @@ module.exports = { name: "bonk", description: "Bonks a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -14,7 +14,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": "https://cdn.discordapp.com/attachments/793537380330111028/801194481549312060/HappyBONK.gif" diff --git a/commands/cheese.js b/commands/cheese.js index ff3da46..88516d2 100644 --- a/commands/cheese.js +++ b/commands/cheese.js @@ -1,7 +1,7 @@ module.exports = { name: "cheese", description: "Cheese an user, or run just ``n!cheese`` for a surprise :eyes:", - async execute(_0, message, _1, footerTxt) { + async execute(_0, message, _1, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { await message.channel.send("*slams cheese on desk*\n**Cheese.** https://www.youtube.com/watch?v=Or4IE8fkpn4"); @@ -12,7 +12,7 @@ module.exports = { "color": 16312092, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": "https://cdn.discordapp.com/attachments/803658122299572255/812867714368536636/R06325af354168febcafd96b8328b7590.png" diff --git a/commands/cuddle.js b/commands/cuddle.js index 35f0183..d14cb10 100644 --- a/commands/cuddle.js +++ b/commands/cuddle.js @@ -9,7 +9,7 @@ module.exports = { name: "cuddle", description: "Cuddle an user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); const index = Math.floor(Math.random() * gifchoices.length); @@ -24,7 +24,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/help.js b/commands/help.js index 1a622fa..940501b 100644 --- a/commands/help.js +++ b/commands/help.js @@ -4,14 +4,14 @@ module.exports = { description: 'Get help on anything from commands, to what the bot does! just not your homework..', syntax: '', - async execute(_0, message, _1, footerTxt) { + async execute(_0, message, _1, config) { await message.channel.send({embed: { "title": "HELP! SEYMOUR! THE BOT IS ON FIRE!", "description": "Get help on anything from commands, to what the bot does! just not your homework..", "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": `${footerTxt} | No mother it's just the northern lights` + "text": `${config.footerTxt} | No mother it's just the northern lights` }, "fields": [ { diff --git a/commands/hug.js b/commands/hug.js index 1d95374..a4ddf72 100644 --- a/commands/hug.js +++ b/commands/hug.js @@ -10,7 +10,7 @@ module.exports = { name: "hug", description: "Hugs a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -23,7 +23,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/info.js b/commands/info.js index f999f7d..4707580 100644 --- a/commands/info.js +++ b/commands/info.js @@ -4,7 +4,7 @@ module.exports = { name: 'info', description: 'Shows bot and host information', - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { function Uptime(uptime) { const totalSeconds = (uptime / 1000); @@ -31,7 +31,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "thumbnail": { "url": client.user.displayAvatarURL() diff --git a/commands/invite.js b/commands/invite.js index 609357c..873e385 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -3,14 +3,14 @@ module.exports = { name: 'invite', description: 'Add Anitrox to your beautiful server!', syntax: [], - async execute(_0, message, _1, footerTxt) { + async execute(_0, message, _1, config) { await message.channel.send({embed: { "title": "Add Anitrox to your Server!", "description": "Weather you want stable, or that squeaky clean fresh PTB build, we gotchu.", "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "thumbnail": { "url": "https://cdn.discordapp.com/attachments/803658122299572255/814352905394061322/anitroxaddsrvr.png" diff --git a/commands/kiss.js b/commands/kiss.js index 10e76ec..6b51e9a 100644 --- a/commands/kiss.js +++ b/commands/kiss.js @@ -10,7 +10,7 @@ module.exports = { name: "kiss", description: "Kisses a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -23,7 +23,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/leskiss.js b/commands/leskiss.js index 703ef79..18242c4 100644 --- a/commands/leskiss.js +++ b/commands/leskiss.js @@ -20,7 +20,7 @@ module.exports = { name: "leskiss", description: "Lesbian kiss <:lesbian:803831629428686849>", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -33,7 +33,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/lick.js b/commands/lick.js index 3764f95..f3573ac 100644 --- a/commands/lick.js +++ b/commands/lick.js @@ -9,7 +9,7 @@ module.exports = { name: "lick", description: "Licks a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -22,7 +22,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": "https://cdn.discordapp.com/attachments/803658122299572255/805314244123951114/cef569820773b0f5d54ee34cfa18e1f8.gif" diff --git a/commands/nom.js b/commands/nom.js index 73684b7..1ace929 100644 --- a/commands/nom.js +++ b/commands/nom.js @@ -9,7 +9,7 @@ module.exports = { name: "nom", description: "Noms an user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -22,7 +22,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/opensource.js b/commands/opensource.js index 8b14c43..762a6c1 100644 --- a/commands/opensource.js +++ b/commands/opensource.js @@ -1,14 +1,14 @@ module.exports = { name: 'opensource', description: 'Attributions to open source components used by Anitrox', - async execute(_0, message, _1, footerTxt){ + async execute(_0, message, _1, config){ await message.channel.send({embed: { "title": "Component Attribution", "description": "Some parts of Anitrox are using open source code, and their attributions are avaliable here!", "color": 52508, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "thumbnail": { "url": "https://cdn.discordapp.com/attachments/803658122299572255/838854256471703602/793885335498522685.png" diff --git a/commands/pat.js b/commands/pat.js index b943223..1d818a0 100644 --- a/commands/pat.js +++ b/commands/pat.js @@ -8,7 +8,7 @@ module.exports = { name: "pat", description: "Pats a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -21,7 +21,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/ping.js b/commands/ping.js index b12e186..77f9544 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,7 +1,7 @@ module.exports = { name: "ping", description: "Gets bot ping", - async execute(client, message, args, config) { + async execute(client, message, _, config) { const index = Math.floor(Math.random() * config.locations.length); const location = config.locations[index] diff --git a/commands/poke.js b/commands/poke.js index 2e77288..46584ba 100644 --- a/commands/poke.js +++ b/commands/poke.js @@ -8,7 +8,7 @@ module.exports = { name: "poke", description: "Pokes a user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -21,7 +21,7 @@ module.exports = { "color": 8311585, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/reload.js b/commands/reload.js index 6bd8f2c..84de5cd 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -34,7 +34,7 @@ module.exports = { "color": 13632027, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "fields": [ { diff --git a/commands/setnick.js b/commands/setnick.js index efa1e1c..3569904 100644 --- a/commands/setnick.js +++ b/commands/setnick.js @@ -1,7 +1,7 @@ module.exports = { name: 'setnick', description: 'Sets your nickname', - async execute(client, message, args, footerTxt) { + async execute(client, message, args, config) { if (message.channel.permissionsFor(message.author).has("CHANGE_NICKNAME")) { const newnick = args.slice(0).join(" ") @@ -13,7 +13,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "fields": [ { diff --git a/commands/slap.js b/commands/slap.js index 4fc6e9c..8e1d41b 100644 --- a/commands/slap.js +++ b/commands/slap.js @@ -2,7 +2,7 @@ module.exports = { name: "slap", description: "Slaps an user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -14,7 +14,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": "https://media1.tenor.com/images/b6d8a83eb652a30b95e87cf96a21e007/tenor.gif?itemid=10426943" diff --git a/commands/snuggle.js b/commands/snuggle.js index 6d6285b..cda8b8a 100644 --- a/commands/snuggle.js +++ b/commands/snuggle.js @@ -9,7 +9,7 @@ module.exports = { name: "snuggle", description: "Snuggle an user!", - async execute(client, message, _, footerTxt) { + async execute(client, message, _, config) { const taggedUser = message.mentions.users.first(); if(!taggedUser) { @@ -22,7 +22,7 @@ module.exports = { "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "image": { "url": gif diff --git a/commands/uinfo.js b/commands/uinfo.js index 527e3fd..f7427a0 100644 --- a/commands/uinfo.js +++ b/commands/uinfo.js @@ -2,14 +2,14 @@ module.exports = { name: "uinfo", description: "Gets info about an user, such as ID, Discord Join date and more", syntax: "", - async execute(client, message, args, footerTxt) { + async execute(client, message, args, config) { const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author await message.channel.send({embed: { "title": `Everything you've ever wanted to know about ${user.username}!`, "color": 9442302, "footer": { "icon_url": message.author.displayAvatarURL(), - "text": footerTxt + "text": config.footerTxt }, "thumbnail": { "url": user.displayAvatarURL() diff --git a/start.js b/start.js index 2c92a2b..9dfde1a 100755 --- a/start.js +++ b/start.js @@ -2,7 +2,6 @@ const fs = require('fs'); const Discord = require('discord.js'); -// const { statuses, build, release, prefix, token, footerTxt } = require('./config.json'); const config = require('./config.json'); console.log('Starting!') const client = new Discord.Client(); From aaae385763d01a03fe6e93cbeab9f78c9c16fe48 Mon Sep 17 00:00:00 2001 From: Nathaniel Mason Date: Tue, 29 Mar 2022 19:55:44 +0100 Subject: [PATCH 3/3] use config param instead of require --- commands/info.js | 6 ++---- commands/restart.js | 4 +--- commands/stop.js | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/commands/info.js b/commands/info.js index 4707580..4ae2ae4 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,5 +1,3 @@ -const {build, release} = require('../config.json'); - module.exports = { name: 'info', @@ -43,12 +41,12 @@ module.exports = { }, { "name": "Release Type", - "value": release, + "value": config.release, "inline": true }, { "name": "Release Version", - "value": build, + "value": config.build, "inline": true }, { diff --git a/commands/restart.js b/commands/restart.js index 2cd54c2..237e03c 100644 --- a/commands/restart.js +++ b/commands/restart.js @@ -1,5 +1,3 @@ -const { token } = require('../config.json'); - module.exports = { name: 'restart', description: '(Owner Only) Shuts down the bot.', @@ -8,7 +6,7 @@ module.exports = { await message.channel.send(" Restarting...") try { client.destroy(); - await client.login(token); + await client.login(config.token); await message.channel.send("<:NyabotSuccess:697211376740859914> Restart Successful") console.log("All systems go") } catch(e) {console.log(e);} diff --git a/commands/stop.js b/commands/stop.js index 95188bc..5fa179c 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -1,7 +1,7 @@ module.exports = { name: "stop", description: "IT'S TIME TO STOP!... the bot", - async execute(client, message, config) { + async execute(_, message, config) { if (message.author.id == config.ownerID) { await message.channel.send({embed: { "title": " **Shutting Down...**",