From b866641fac662e115086735868af54b7b0f8e21b Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Sat, 2 Jul 2022 21:07:43 -0500 Subject: [PATCH 01/33] Add functions, getTime function. This is for logging --- functions/getTime.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 functions/getTime.js diff --git a/functions/getTime.js b/functions/getTime.js new file mode 100644 index 0000000..8e7a596 --- /dev/null +++ b/functions/getTime.js @@ -0,0 +1,7 @@ +module.exports = () => { + const date = new Date(); + const timeDate = date.toLocaleDateString(); + const time = date.toLocaleTimeString(); + + return ` ${time} | ${timeDate} `; +}; From f5f94a1026229fd1bc62098c939a521fb14b01e2 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 4 Jul 2022 11:08:50 -0500 Subject: [PATCH 02/33] Fix the embed name returning an userID instead of username --- commands/uinfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/uinfo.js b/commands/uinfo.js index 438413a..106dbee 100644 --- a/commands/uinfo.js +++ b/commands/uinfo.js @@ -24,7 +24,7 @@ module.exports = { handle (client, config, user, target) { return { embeds: [{ - title: `Everything you've ever wanted to know about ${target}!`, + title: `Everything you've ever wanted to know about ${target.user.username}!`, color: 9442302, footer: { icon_url: user.displayAvatarURL(), From f67548a159e20df18f875d924ecf8c3db52783eb Mon Sep 17 00:00:00 2001 From: Sophie Marie Date: Mon, 4 Jul 2022 11:42:50 -0500 Subject: [PATCH 03/33] Delete embeds.json --- embeds.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 embeds.json diff --git a/embeds.json b/embeds.json deleted file mode 100644 index 8b13789..0000000 --- a/embeds.json +++ /dev/null @@ -1 +0,0 @@ - From 8d154b5e8a50a9015eca9d634f4e56b0bd189c6d Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Mon, 4 Jul 2022 11:53:42 -0500 Subject: [PATCH 04/33] Make totalSeconds use process.uptime(); --- commands/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/info.js b/commands/info.js index 8c1eea8..7abff07 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,5 +1,5 @@ function Uptime (uptime) { - const totalSeconds = (uptime / 1000); + const totalSeconds = process.uptime(); const days = parseInt(totalSeconds / 86400); const hours = parseInt((totalSeconds % 86400) / 3600); From af6b091cda7cdee9a3b5952bf3d0e486f6266e50 Mon Sep 17 00:00:00 2001 From: Sophie Mondzelewski Date: Tue, 5 Jul 2022 11:51:30 -0500 Subject: [PATCH 05/33] Fix an oopsie poopsie, a fucky wucky! --- commands/stop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/stop.js b/commands/stop.js index 1c2d07d..2eb4891 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -18,7 +18,7 @@ module.exports = { await channel.send({ embeds: [{ title: '**Shut down the bot**', - description: ':AnitroxWorking: **Shutting Down...**', + description: ' **Shutting Down...**', color: 9442302, footer: { icon_url: user.displayAvatarURL(), From 917d6a8c19d93e966652f7447577967d97b3f4fd Mon Sep 17 00:00:00 2001 From: Sophie Mondzelewski Date: Tue, 5 Jul 2022 11:55:42 -0500 Subject: [PATCH 06/33] Move uptime to a file, This is partially for logging --- functions/uptime.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 functions/uptime.js diff --git a/functions/uptime.js b/functions/uptime.js new file mode 100644 index 0000000..b10b8cf --- /dev/null +++ b/functions/uptime.js @@ -0,0 +1,17 @@ +module.exports = () => { + const tSeconds = process.uptime(); + + const tDays = parseInt(tSeconds / 86400); + const tHrs = parseInt((tSeconds % 86400) / 3600); + const tMins = parseInt((tSeconds % 3600) / 60); + const tSecs = parseInt(tSeconds % 60); + // We can probably just return tSeconds (totalSeconds) instead of parsing. + // So that was a fucking lie. + + const days = tDays + (tDays === 1 ? ' day' : ' days'); + const hours = tHrs + (tHrs === 1 ? ' hour' : ' hours'); + const minutes = tMins + (tMins === 1 ? ' minute' : ' hours'); + const seconds = tSecs + (tSecs === 1 ? ' second' : ' seconds'); + + return `${days}, ${hours}, ${minutes}, ${seconds}`; +}; From e378121fbe741726484d41fcf50d1f0ab1bfd253 Mon Sep 17 00:00:00 2001 From: Sophie Mondzelewski Date: Tue, 5 Jul 2022 12:28:31 -0500 Subject: [PATCH 07/33] Fix tSeconds making SystemUptime be the same as BotUptime --- events/ready.js | 1 + functions/uptime.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/events/ready.js b/events/ready.js index fac68ac..8447da3 100644 --- a/events/ready.js +++ b/events/ready.js @@ -46,6 +46,7 @@ module.exports = { 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 diff --git a/functions/uptime.js b/functions/uptime.js index b10b8cf..7718eff 100644 --- a/functions/uptime.js +++ b/functions/uptime.js @@ -1,5 +1,5 @@ -module.exports = () => { - const tSeconds = process.uptime(); +module.exports = (uptime) => { + const tSeconds = (uptime / 1000); const tDays = parseInt(tSeconds / 86400); const tHrs = parseInt((tSeconds % 86400) / 3600); From 77517f6a168b1d29aedc06b65c38b3a2f8291d6d Mon Sep 17 00:00:00 2001 From: Sophie Mondzelewski Date: Tue, 5 Jul 2022 12:29:14 -0500 Subject: [PATCH 08/33] Make info use the new external function for uptime --- commands/info.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/commands/info.js b/commands/info.js index 7abff07..1392773 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,19 +1,4 @@ -function Uptime (uptime) { - const totalSeconds = process.uptime(); - - const days = parseInt(totalSeconds / 86400); - const hours = parseInt((totalSeconds % 86400) / 3600); - const minutes = parseInt((totalSeconds % 3600) / 60); - const seconds = parseInt(totalSeconds % 60); - - const daystring = days + (days === 1 ? ' day' : ' days'); - const hourstring = hours + (hours === 1 ? ' hour' : ' hours'); - const minutestring = minutes + (minutes === 1 ? ' minute' : ' minutes'); - const secondstring = seconds + (seconds === 1 ? ' second' : ' seconds'); - - return `${daystring}**, **${hourstring}**, **${minutestring}**, **${secondstring}`; -} - +const Uptime = require('../functions/uptime.js'); const os = require('os'); const osu = require('node-os-utils'); const cpu = osu.cpu; From 43f73c5403c76420c875630e06a9ffad7b6193a4 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Thu, 14 Jul 2022 12:49:54 -0500 Subject: [PATCH 09/33] Pass client to eval --- commands/eval.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/eval.js b/commands/eval.js index df12710..c7a88bc 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -20,7 +20,7 @@ module.exports = { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('code'))); }, - handle (_, config, user, code) { + handle (client, config, user, code) { if (user.id === config.ownerID) { try { const evaled = inspect(eval(code)); From dca559b36525e8c77dfe0551edf0310019c9b774 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Sat, 16 Jul 2022 12:10:37 -0500 Subject: [PATCH 10/33] Fix minutes displaying as hours --- functions/uptime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/uptime.js b/functions/uptime.js index 7718eff..ba0a557 100644 --- a/functions/uptime.js +++ b/functions/uptime.js @@ -10,7 +10,7 @@ module.exports = (uptime) => { const days = tDays + (tDays === 1 ? ' day' : ' days'); const hours = tHrs + (tHrs === 1 ? ' hour' : ' hours'); - const minutes = tMins + (tMins === 1 ? ' minute' : ' hours'); + const minutes = tMins + (tMins === 1 ? ' minute' : ' minutes'); const seconds = tSecs + (tSecs === 1 ? ' second' : ' seconds'); return `${days}, ${hours}, ${minutes}, ${seconds}`; From a50b45e78483cdef3bee9d1a7448f6e271da4d3c Mon Sep 17 00:00:00 2001 From: Sophie Marie Date: Mon, 18 Jul 2022 12:03:50 -0500 Subject: [PATCH 11/33] Rewrite bot info and embed (#59) --- commands/info.js | 156 ++++++++++++++++------------------------------- 1 file changed, 54 insertions(+), 102 deletions(-) diff --git a/commands/info.js b/commands/info.js index 1392773..565de1f 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,102 +1,54 @@ -const Uptime = require('../functions/uptime.js'); -const os = require('os'); -const osu = require('node-os-utils'); -const cpu = osu.cpu; - -module.exports = { - - name: require('path').parse(__filename).name, - description: 'Shows bot and host information', - options: [], - - async parseMessage (client, config, message) { - await message.channel.send(this.handle(client, config, message.author)); - }, - - async parseInteraction (client, config, interaction) { - await interaction.reply(this.handle(client, config, interaction.user)); - }, - - handle (client, config, user) { - return { - embeds: [{ - title: '<:AnitroxInfo:809651936831733791> Information about Anitrox', - description: "Everything you've ever wanted to know about your favorite bot, Anitrox!", - color: 9442302, - footer: { - icon_url: user.displayAvatarURL(), - text: config.footerTxt - }, - thumbnail: { - url: client.user.displayAvatarURL() - }, - fields: [ - { - name: 'Bot Information', - value: '** **' - }, - { - name: 'Release Type', - value: config.release, - inline: true - }, - { - name: 'Release Version', - value: config.build, - inline: true - }, - { - name: 'Uptime', - value: Uptime(client.uptime), - inline: true - }, - { - name: '<:memory:793536677737136178> Bot Memory Usage', - value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`, - inline: true - }, - { - name: 'Bot Name', - value: client.user.tag, - inline: true - }, - { - name: 'Bot ID', - value: `\`${client.user.id}\``, - inline: true - }, - { - name: '<:hostinfo:793529505263517747> Host Information', - value: '** **' - }, - { - name: '<:hostinfo:793529505263517747> Host Uptime', - value: Uptime(os.uptime() * 1000) - }, - { - name: '<:cpu:793672442056802354> CPU Type', - value: `${process.arch}, ${cpu.model()}` - }, - - { - name: '<:hostos:793866961675223090> OS Type', - value: `${process.platform} / ${os.version()}` - }, - { - name: '<:node:793537507018145813> Node.JS Version', - value: process.version - }, - { - name: '<:hostinfo:793529505263517747> Bot Ping', - value: `${Math.round(client.ws.ping)} ms`, - inline: true - }, - { - name: '**Special Thanks To**', - value: '@OfficialTCGMatt for providing help with development\n @chuu_shi Allowing me to host Anitrox on his server' - } - ] - }] - }; - } -}; +const Uptime = require('../functions/uptime.js'); +const os = require('os'); +const osu = require('node-os-utils'); +const config = require('../config.json'); +module.exports = { + name: 'info', + description: 'Bot and System information', + options: [], + + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author)); + }, + // We'll be moving solely to Slash Commands in 1.4 + + async parseInteraction (client, config, interaction) { + await interaction.reply(this.handle(client, config, interaction.user)); + }, + + handle (client, config, user) { + return { + embeds: [{ + title: `<:AnitroxInfo:809651936831733791> Information about ${client.user.username}`, + description: `Everything you've ever wanted to know about your favorite bot, ${client.user.username}!`, + color: 9442302, + footer: { + icon_url: user.displayAvatarURL(), + text: config.footerTxt + }, + thumbnail: { + url: client.user.displayAvatarURL() + }, + fields: [ + { name: '<:anitrox:831193012699791361> Bot Information', value: '** **' }, + { name: 'Bot Name', value: `${client.user.tag}`, inline: true }, + { name: 'Bot ID', value: `${client.user.id}`, inline: true }, + { name: 'Bot Owner', value: isNaN(config.ownerID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(config.ownerID).username, inline: true }, + { name: 'Release Type', value: config.release, inline: true }, + { name: 'Version', value: config.build, inline: true }, + { name: ':gear: Bot Process Information', value: '** **' }, + { name: '<:memory:997565609179107369> Bot Memory Usage', value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`, inline: true }, + { name: ':timer: Bot Uptime', value: Uptime(client.uptime), inline: true }, + { name: ':one: Total Servers', value: `** **${client.guilds.cache.size}`, inline: true }, + { name: '<:hostinfo:997565639352926250> System Information', value: '** **' }, + { name: `${((process.platform === 'linux') ? '<:linux_tux:997565742960615424>' : '<:windows:997919047511453696>')} System Platform`, value: process.platform, inline: true }, + { name: `${((process.platform === 'linux') ? ':gear: Kernel Version' : ':gear: System Version')}`, value: os.release(), inline: true }, + { name: ':timer: System Uptime', value: Uptime(os.uptime() * 1000), inline: true }, + { name: '<:cpu:997565592028598282> System CPU Architecture', value: os.arch(), inline: true }, + { name: '<:cpu:997565592028598282> System CPU Model', value: osu.cpu.model(), inline: true }, + { name: '<:nodejs:998609124453531740> Node.js Version', value: process.version, inline: true } + ] + }] + }; + } +}; From 2661631c10dd7f360a61fc726bc3c6902c303d63 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Fri, 22 Jul 2022 20:47:35 -0500 Subject: [PATCH 12/33] Remove unneeded value --- commands/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/info.js b/commands/info.js index 565de1f..bc0ab78 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,7 +1,7 @@ const Uptime = require('../functions/uptime.js'); const os = require('os'); const osu = require('node-os-utils'); -const config = require('../config.json'); +// const config = require('../config.json'); module.exports = { name: 'info', description: 'Bot and System information', From 7541b53492f78dfeaacec07edd09010d7dfc1ee3 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Fri, 22 Jul 2022 21:40:18 -0500 Subject: [PATCH 13/33] Wait that was suppose to be removed, not a comment. --- commands/info.js | 1 - 1 file changed, 1 deletion(-) diff --git a/commands/info.js b/commands/info.js index bc0ab78..6906ecb 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,7 +1,6 @@ const Uptime = require('../functions/uptime.js'); const os = require('os'); const osu = require('node-os-utils'); -// const config = require('../config.json'); module.exports = { name: 'info', description: 'Bot and System information', From 09d14f7a7d58885c5cad35deff7daf089e0954b7 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Fri, 22 Jul 2022 21:51:16 -0500 Subject: [PATCH 14/33] Update support --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0de5cfd..89c204d 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ This is the stable branch, If you want the prepackaged and prepared builds, you're at the right place. # Dependencies to get started To begin, you will need to satisfy the following dependencies: -Node.JS: 14 +Node.JS: 16 npm: 6.14 # Let's get this ~~party~~ bot started! For first time start up, You will need to run ``npm install`` to install the needed npm packages. Afterwards fill out the ``config-example.json`` and rename it to ``config.json``, then just run ``node start.js`` (or ``./start.js`` on Linux)! ⚠️ If you don't specify the Owner ID, Some commands such as the bot controls will be unusable! # Support -Anitrox isn't really supported but you can get help from the Discord server if you need any: discord.gg/5nQtMNpf43 +Support is available on the [Discord Server!](discord.gg/5nQtMNpf43), or @ me on [Twitter!](twitter.com/IDeleteSystem64); From e1056c4d20fbbaf09161c8868aa10ef69be1bc33 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Fri, 22 Jul 2022 21:53:40 -0500 Subject: [PATCH 15/33] Add new dependencies: node-fetch, dotenv --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 4457737..8770d86 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "main": "start.js", "dependencies": { "discord.js": "^13.6.0", + "dotenv": "^16.0.1", + "node-fetch": "^3.2.9", "node-os-utils": "^1.3.2", "require-all": "^3.0.0" }, From d527cab9f5cd4f90e86ff75aca23c4c01f81177d Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Tue, 26 Jul 2022 20:44:00 -0500 Subject: [PATCH 16/33] Refactor entire help command, unfinished. There are still a few thing's that need to be worked on, such as showing a category. This will rely on getting the parent folder of the command since I want to start categorizing everything like I should be to help make things easier to find. --- commands/help.js | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/commands/help.js b/commands/help.js index 99ee3e5..77e7377 100644 --- a/commands/help.js +++ b/commands/help.js @@ -2,35 +2,45 @@ module.exports = { name: require('path').parse(__filename).name, description: 'Get help on anything from commands, to what the bot does! just not your homework..', - options: [], - - async parseMessage (client, config, message) { - await message.channel.send(this.handle(client, config, message.author)); + options: [{ + name: '', + description: 'View Information about this command', + required: false + }], + async parseMessage (client, config, message, args) { + await message.channel.send(this.handle(client, config, message.author, args)); }, async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user)); }, - handle (_, config, user) { + handle (client, config, user, args) { + if (!args[0]) { + return client.generateErrorMessage('Note to self: Design default help embed.', user.displayAvatarURL()); + } + + const cmdName = args[0].toLowerCase(); + const cmd = client.commands.get(cmdName); + + if (!cmd) { + return client.generateErrorMessage(`${cmdName} is not a valid command! Run ${config.prefix}help for a command list.`); + } return { embeds: [{ - 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, + title: ':question: Command Help', + description: `Everything you've ever wanted to know about ${cmdName}!`, footer: { icon_url: user.displayAvatarURL(), - text: `${config.footerTxt} | No mother it's just the northern lights` + text: config.footerTxt }, fields: [ - { - name: 'Command List', - value: '[Click here!](https://github.com/IDeletedSystem64/anitrox/blob/dev/commands.md)' - }, - { - name: '...Or is the bot actually on fire?', - value: 'Join the [support server!](https://discord.gg/grebRGsBZ3)' - } + { name: 'Command Name', value: `${cmdName}`, inline: true }, + { name: 'Command Description', value: cmd.description, inline: true }, + { name: 'Command Options', value: cmd.options.map(option => option.name).join('\n') || 'None', inline: true }, + { name: 'Command Option Description', value: cmd.options.map(option => option.description).join('\n') || 'None', inline: true }, + { name: 'Option Legend', value: '[Option] REQUIRED\n