diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..54a5a11
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,3 @@
+TOKEN="EVERYTHINGS SO FCKED AND IM TIRED OF BEING SCARED"
+OWNERID="SO LETS GET OUT AND FCK UP EQUESTRIA"
+# Do !!NOT!! share this file once filled out with anybody, Doing so can leak your Bot Token which will give anyone access to your bot!
diff --git a/.gitignore b/.gitignore
index dc2fb20..a703372 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ node_modules/
.vscode
package-lock.json
releasenotes.txt
-config.json
\ No newline at end of file
+config.json
+.env
diff --git a/README.md b/README.md
index 0de5cfd..fced111 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,12 @@
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)!
+Afterwards fill out the ``.env.example`` and ``config-example.json`` and then rename them to ``.env`` and ``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)
diff --git a/commands.md b/commands.md
deleted file mode 100644
index 6d5e7db..0000000
--- a/commands.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Anitrox Command List
-<> = Optionable
-
-[] = Required
-
-|Command|Arguments |Description |
-|-------|----------|------------|
-|Help |none |Help? Help!!|
-|8ball |[Question]|Ask a question, Any question! |
-|avatar |\ |Get a users beautiful avatar |
-|bonk |[Member] | Bonk, no horny. |
-|cheese |\| Cheese.|
-|cuddle |[Member] | Cuddle someone! |
-|choose |[Option1]
[Option2]
[and so on] | Choose from a list of choices, as many as you want!
-|hug |[Member] | Hug someone! |
-|info |none | Information about the bot and host.
-|invite |none | Invite Anitrox to your server!
-|kiss |[Member] | Kiss someone! |
-|leskiss|[Member] | Lesbain kiss (Suggested by Emi)
-|lick |[Member] | Did you just lick me!?
-|nom |[Member] | Nom someone or something
-|opensource|none | Source code for Anitrox
-|pat |[Member] | Pat someone!
-|ping |none | Ping Elon Musk! or Mars! nah jk, Discord.
-|poke |[Member] | Poke someone!
-|slap |[Member] | Slap someone :(
-|snuggle|[Member] | Snuggle someone!
-|uinfo |[Member] | Information about an user
diff --git a/commands/eval.js b/commands/eval.js
index df12710..20b82d5 100644
--- a/commands/eval.js
+++ b/commands/eval.js
@@ -20,8 +20,8 @@ module.exports = {
await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('code')));
},
- handle (_, config, user, code) {
- if (user.id === config.ownerID) {
+ handle (client, config, user, code) {
+ if (user.id === process.env.OWNERID) {
try {
const evaled = inspect(eval(code));
// await message.channel.send(evaled, { code: 'xl' });
diff --git a/commands/help.js b/commands/help.js
index 99ee3e5..1b9eb6d 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -1,36 +1,62 @@
+const { Constants } = require('discord.js');
+
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: 'help',
+ description: 'The command you want information on',
+ required: false,
+ type: Constants.ApplicationCommandOptionTypes.STRING
+ }],
+ async parseMessage (client, config, message, args) {
+ await message.channel.send(this.handle(client, config, message.author, args[0]));
},
async parseInteraction (client, config, interaction) {
- await interaction.reply(this.handle(client, config, interaction.user));
+ await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('help')));
},
- handle (_, config, user) {
+ handle (client, config, user, command) {
+ if (!command) {
+ return {
+ embeds: [{
+ color: 9442302,
+ title: `:question: SEYMOUR! THE ${client.user.username} IS ON FIRE!`,
+ description: `Run ${config.prefix}help for more information on each command.`,
+ footer: {
+ icon_url: user.displayAvatarURL(),
+ text: config.footerTxt
+ },
+ fields: [
+ { name: 'Commands', value: client.commands.map(command => command.name).join(', ') }
+ ]
+ }]
+ };
+ }
+
+ const cmdName = command;
+ const cmd = client.commands.get(cmdName);
+ console.log(cmd.options.map);
+ 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: 'Command Option Required?', value: cmd.options.map(option => option.required) ? 'Yes' : 'No' }
]
}]
};
diff --git a/commands/info.js b/commands/info.js
index 8c1eea8..c87efd7 100644
--- a/commands/info.js
+++ b/commands/info.js
@@ -1,117 +1,53 @@
-function Uptime (uptime) {
- const totalSeconds = (uptime / 1000);
-
- 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 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');
+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(process.env.OWNERID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(process.env.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 }
+ ]
+ }]
+ };
+ }
+};
diff --git a/commands/invite.js b/commands/invite.js
index f918bfa..a809d75 100644
--- a/commands/invite.js
+++ b/commands/invite.js
@@ -26,18 +26,10 @@ module.exports = {
url: 'https://cdn.discordapp.com/attachments/803658122299572255/814352905394061322/anitroxaddsrvr.png'
},
fields: [
- {
- name: 'Anitrox',
- value: 'Get the ripe off the vine Anitrox! \n [Add Anitrox to your server](https://discord.com/oauth2/authorize?client_id=576805923964715018&scope=bot&permissions=8)'
- },
- {
- name: 'Anitrox PTB (Public Test Build)',
- value: 'So you want the fresh and hot builds straight from the oven? We gotchu \n [Add Anitrox PTB to your server](https://discord.com/oauth2/authorize?client_id=489125054261755925&scope=bot&permissions=66186303)'
- },
- {
- name: 'Need help?',
- value: 'Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)'
- }
+ { name: 'Anitrox', value: 'Get the ripe off the vine Anitrox! \n [Add Anitrox to your server](https://discord.com/oauth2/authorize?client_id=576805923964715018&scope=bot&permissions=8)' },
+ { name: 'Anitrox PTB (Public Test Build)', value: 'So you want the fresh and hot builds straight from the oven? We gotchu \n [Add Anitrox PTB to your server](https://discord.com/oauth2/authorize?client_id=489125054261755925&scope=bot&permissions=66186303)' },
+ { name: 'Anitrox Dev, Self hosting and more!', value: 'Self-host your own Anitrox (including dev!), Contribute, and more! The possibilites are endless. [Anitrox Source](https://github.com/IDeletedSystem64/anitrox)' },
+ { name: 'Need help?', value: 'Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)' }
]
}]
};
diff --git a/commands/reload.js b/commands/reload.js
index 5684d5a..9f89ac1 100644
--- a/commands/reload.js
+++ b/commands/reload.js
@@ -5,7 +5,7 @@ module.exports = {
name: require('path').parse(__filename).name,
description: 'Reloads a command',
options: [...Array(10).keys()].map(i => ({
- name: `option${i + 1}`,
+ name: `option${i + 0}`,
description: 'Another option',
required: i === 0,
type: Constants.ApplicationCommandOptionTypes.STRING
@@ -20,7 +20,7 @@ module.exports = {
},
handle (client, config, user, args) {
- if (user.id === config.ownerID) {
+ if (user.id === process.env.OWNERID) {
if (!args.length) return client.generateErrorMessage('You forgot to provide anything to reload, you pillock', user.displayAvatarURL());
let returnMessage = '';
diff --git a/commands/restart.js b/commands/restart.js
index 992790d..51c91a2 100644
--- a/commands/restart.js
+++ b/commands/restart.js
@@ -13,9 +13,9 @@ module.exports = {
},
async handle (client, config, user, channel) {
- if (user.id === config.ownerID) {
+ if (user.id === process.env.OWNERID) {
const embeds = [{
- title: ' Restart Bot',
+ title: ' Restart Bot',
description: 'Restarting Anitrox...',
color: 9442302,
footer: {
@@ -27,11 +27,11 @@ module.exports = {
const response = await channel.send({ embeds });
try {
client.destroy();
- await client.login(config.token);
+ await client.login(process.env.TOKEN);
console.log('[SYSTEM] [INFO] Restarted successfully!');
await response.edit({
embeds: [{
- title: ' Restart Bot',
+ title: ':white_check_mark: Restart Bot',
description: 'Restarted!',
color: 9442302,
footer: {
diff --git a/commands/stop.js b/commands/stop.js
index 1c2d07d..9035530 100644
--- a/commands/stop.js
+++ b/commands/stop.js
@@ -13,12 +13,12 @@ module.exports = {
},
async handle (client, config, user, channel) {
- if (user.id === config.ownerID) {
+ if (user.id === process.env.OWNERID) {
console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. \nShutdown requested by ${user.username}`);
await channel.send({
embeds: [{
title: '**Shut down the bot**',
- description: ':AnitroxWorking: **Shutting Down...**',
+ description: ' **Shutting Down...**',
color: 9442302,
footer: {
icon_url: user.displayAvatarURL(),
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(),
diff --git a/config-example.json b/config-example.json
index c5b8a2a..56e1a1d 100644
--- a/config-example.json
+++ b/config-example.json
@@ -1,9 +1,7 @@
{
"prefix": "n!",
- "token": "IM SO EXCITED ABOUT BURGER",
- "ownerID": "MY FAVORITE COLOR IS TWELVE",
"release": "Stable Release",
- "build": "1.2.2",
+ "build": "1.3",
"footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022",
"sandbox": {
"enabled": false,
@@ -37,8 +35,15 @@
"127.0.0.1",
"Sophie's computer",
"Mars",
- "Elon Musk",
- "TMC Software"
+ "Netro Corporation",
+ "System64 Technologies",
+ "myself",
+ "Twilight Sparkle",
+ "the Pokemon Center",
+ "Who asked?",
+ "you",
+ "your mother"
+
],
"answers": [
"Heck no!",
diff --git a/embeds.json b/embeds.json
deleted file mode 100644
index 8b13789..0000000
--- a/embeds.json
+++ /dev/null
@@ -1 +0,0 @@
-
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/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} `;
+};
diff --git a/functions/uptime.js b/functions/uptime.js
new file mode 100644
index 0000000..2133dab
--- /dev/null
+++ b/functions/uptime.js
@@ -0,0 +1,15 @@
+module.exports = (uptime) => {
+ const tSeconds = (uptime / 1000);
+
+ const tDays = parseInt(tSeconds / 86400);
+ const tHrs = parseInt((tSeconds % 86400) / 3600);
+ const tMins = parseInt((tSeconds % 3600) / 60);
+ const tSecs = parseInt(tSeconds % 60);
+
+ const days = tDays + (tDays === 1 ? ' day' : ' days');
+ const hours = tHrs + (tHrs === 1 ? ' hour' : ' hours');
+ const minutes = tMins + (tMins === 1 ? ' minute' : ' minutes');
+ const seconds = tSecs + (tSecs === 1 ? ' second' : ' seconds');
+
+ return `${days}, ${hours}, ${minutes}, ${seconds}`;
+};
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"
},
diff --git a/start.js b/start.js
index 6d2403b..3c37ded 100755
--- a/start.js
+++ b/start.js
@@ -3,7 +3,7 @@
const fs = require('fs');
const Discord = require('discord.js');
const config = require('./config.json');
-
+require('dotenv').config();
console.log('Starting!');
const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`)) });
@@ -14,6 +14,7 @@ fs.readdirSync('./commands')
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
});
+// Create a collection using those command files
fs.readdirSync('./events')
.filter(file => file.endsWith('.js'))
@@ -21,6 +22,7 @@ fs.readdirSync('./events')
.forEach(({ once, event, listener }) => {
client[once ? 'once' : 'on'](event, listener(client, config));
});
+// Create listeners from the event files.
client.generateErrorMessage = (errorMsg, avatarURL) => ({
embeds: [{
@@ -39,4 +41,5 @@ client.generateErrorMessage = (errorMsg, avatarURL) => ({
}]
});
-client.login(config.token);
+client.login(process.env.TOKEN);
+// Login to Discord!