Merge pull request #64 from IDeletedSystem64/dev

Public Test Build v1.3
This commit is contained in:
Sophie Marie 2022-07-26 20:48:41 -05:00 committed by GitHub
commit f7f332d654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 126 additions and 168 deletions

View File

@ -1,13 +1,13 @@
# Anitrox Dev Branch (anitrox_unstable) # Anitrox Stable Branch (anitrox_stable)
This is the development branch for Anitrox, If you want those fresh hot Anitrox builds right from the oven, you've come to the right place! This is the stable branch, If you want the prepackaged and prepared builds, you're at the right place.
# Dependencies to get started # Dependencies to get started
To begin, you will need to satisfy the following dependencies: To begin, you will need to satisfy the following dependencies:
Node.JS: 14 Node.JS: 16
npm: 6.14 npm: 6.14
# Let's get this ~~party~~ bot started! # 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. 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 ``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! ⚠️ If you don't specify the Owner ID, Some commands such as the bot controls will be unusable!
# Support # 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);

View File

@ -20,7 +20,7 @@ module.exports = {
await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('code'))); 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) { if (user.id === config.ownerID) {
try { try {
const evaled = inspect(eval(code)); const evaled = inspect(eval(code));

View File

@ -2,35 +2,45 @@ module.exports = {
name: require('path').parse(__filename).name, name: require('path').parse(__filename).name,
description: 'Get help on anything from commands, to what the bot does! just not your homework..', description: 'Get help on anything from commands, to what the bot does! just not your homework..',
options: [], options: [{
name: '<Command>',
async parseMessage (client, config, message) { description: 'View Information about this command',
await message.channel.send(this.handle(client, config, message.author)); required: false
}],
async parseMessage (client, config, message, args) {
await message.channel.send(this.handle(client, config, message.author, args));
}, },
async parseInteraction (client, config, interaction) { async parseInteraction (client, config, interaction) {
await interaction.reply(this.handle(client, config, interaction.user)); 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 { return {
embeds: [{ 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, color: 9442302,
title: ':question: Command Help',
description: `Everything you've ever wanted to know about ${cmdName}!`,
footer: { footer: {
icon_url: user.displayAvatarURL(), icon_url: user.displayAvatarURL(),
text: `${config.footerTxt} | No mother it's just the northern lights` text: config.footerTxt
}, },
fields: [ fields: [
{ { name: 'Command Name', value: `${cmdName}`, inline: true },
name: 'Command List', { name: 'Command Description', value: cmd.description, inline: true },
value: '[Click here!](https://github.com/IDeletedSystem64/anitrox/blob/dev/commands.md)' { 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<Option> OPTIONAL' }
name: '...Or is the bot actually on fire?',
value: 'Join the [support server!](https://discord.gg/grebRGsBZ3)'
}
] ]
}] }]
}; };

View File

@ -1,117 +1,53 @@
function Uptime (uptime) { const Uptime = require('../functions/uptime.js');
const totalSeconds = (uptime / 1000); const os = require('os');
const osu = require('node-os-utils');
const days = parseInt(totalSeconds / 86400); module.exports = {
const hours = parseInt((totalSeconds % 86400) / 3600); name: 'info',
const minutes = parseInt((totalSeconds % 3600) / 60); description: 'Bot and System information',
const seconds = parseInt(totalSeconds % 60); options: [],
const daystring = days + (days === 1 ? ' day' : ' days'); async parseMessage (client, config, message) {
const hourstring = hours + (hours === 1 ? ' hour' : ' hours'); await message.channel.send(this.handle(client, config, message.author));
const minutetring = minutes + (minutes === 1 ? ' minute' : ' minutes'); },
const secondstring = seconds + (seconds === 1 ? ' second' : ' seconds'); // We'll be moving solely to Slash Commands in 1.4
return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`; async parseInteraction (client, config, interaction) {
} await interaction.reply(this.handle(client, config, interaction.user));
},
const os = require('os');
const osu = require('node-os-utils'); handle (client, config, user) {
const cpu = osu.cpu; return {
embeds: [{
module.exports = { title: `<:AnitroxInfo:809651936831733791> Information about ${client.user.username}`,
description: `Everything you've ever wanted to know about your favorite bot, ${client.user.username}!`,
name: require('path').parse(__filename).name, color: 9442302,
description: 'Shows bot and host information', footer: {
options: [], icon_url: user.displayAvatarURL(),
text: config.footerTxt
async parseMessage (client, config, message) { },
await message.channel.send(this.handle(client, config, message.author)); thumbnail: {
}, url: client.user.displayAvatarURL()
},
async parseInteraction (client, config, interaction) { fields: [
await interaction.reply(this.handle(client, config, interaction.user)); { name: '<:anitrox:831193012699791361> Bot Information', value: '** **' },
}, { name: 'Bot Name', value: `${client.user.tag}`, inline: true },
{ name: 'Bot ID', value: `${client.user.id}`, inline: true },
handle (client, config, user) { { name: 'Bot Owner', value: isNaN(config.ownerID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(config.ownerID).username, inline: true },
return { { name: 'Release Type', value: config.release, inline: true },
embeds: [{ { name: 'Version', value: config.build, inline: true },
title: '<:AnitroxInfo:809651936831733791> Information about Anitrox', { name: ':gear: Bot Process Information', value: '** **' },
description: "Everything you've ever wanted to know about your favorite bot, Anitrox!", { name: '<:memory:997565609179107369> Bot Memory Usage', value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`, inline: true },
color: 9442302, { name: ':timer: Bot Uptime', value: Uptime(client.uptime), inline: true },
footer: { { name: ':one: Total Servers', value: `** **${client.guilds.cache.size}`, inline: true },
icon_url: user.displayAvatarURL(), { name: '<:hostinfo:997565639352926250> System Information', value: '** **' },
text: config.footerTxt { 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 },
thumbnail: { { name: ':timer: System Uptime', value: Uptime(os.uptime() * 1000), inline: true },
url: client.user.displayAvatarURL() { name: '<:cpu:997565592028598282> System CPU Architecture', value: os.arch(), inline: true },
}, { name: '<:cpu:997565592028598282> System CPU Model', value: osu.cpu.model(), inline: true },
fields: [ { name: '<:nodejs:998609124453531740> Node.js Version', value: process.version, inline: true }
{ ]
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'
}
]
}]
};
}
};

View File

@ -47,22 +47,8 @@ module.exports = {
return returnMessage; return returnMessage;
} else { } else {
return { console.error(`[SYSTEM] [ERR] User ${user.username} tried to reload ${args[0]}, but doesn't have permission!`);
embeds: [{ return client.generateErrorMessage("You don't have permission to run this command.", user.displayAvatarURL());
title: '<:AnitroxDenied:809651936642203668> **403 Forbidden**',
color: 13632027,
footer: {
icon_url: user.displayAvatarURL(),
text: config.footerTxt
},
fields: [
{
name: '**What Happened?**',
value: "You don't have the appropriate permissions to run this command!"
}
]
}]
};
} }
} }
}; };

View File

@ -43,7 +43,7 @@ module.exports = {
} catch (e) { console.error(e); } } catch (e) { console.error(e); }
} else { } else {
console.error('[SYSTEM] [ERR] User ' + user.username + " tried to restart the bot, but doesn't have permission! If this was you, Check your config.json"); console.error('[SYSTEM] [ERR] User ' + user.username + " tried to restart the bot, but doesn't have permission! If this was you, Check your config.json");
return client.generateErrorMessage('Only the bot owner can restart the bot! Stop.', user.displayAvatarURL()); await channel.send(client.generateErrorMessage('You do not have permission to run this command.', user.displayAvatarURL()));
} }
} }
}; };

View File

@ -5,19 +5,17 @@ module.exports = {
options: [], options: [],
async parseMessage (client, config, message) { async parseMessage (client, config, message) {
await message.channel.send(await this.handle(client, config, message.author)); await this.handle(client, config, message.author, message.channel);
process.exit();
}, },
async parseInteraction (client, config, interaction) { async parseInteraction (client, config, interaction) {
await interaction.reply(await this.handle(client, config, interaction.user)); await this.handle(client, config, interaction.user, interaction.channel);
process.exit();
}, },
async handle (client, config, user) { async handle (client, config, user, channel) {
if (user.id === config.ownerID) { if (user.id === config.ownerID) {
console.log('[SYSTEM] [INFO] ' + ` The bot is going down for shut down. \nShutdown requested by ${user.username}`); console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. \nShutdown requested by ${user.username}`);
return { await channel.send({
embeds: [{ embeds: [{
title: '**Shut down the bot**', title: '**Shut down the bot**',
description: '<a:AnitroxWorking:697147309531594843> **Shutting Down...**', description: '<a:AnitroxWorking:697147309531594843> **Shutting Down...**',
@ -27,10 +25,11 @@ module.exports = {
text: config.footerTxt text: config.footerTxt
} }
}] }]
}; });
process.exit();
} else { } else {
console.error('[SYSTEM] [ERR] User ' + user.username + " tried to shut down the bot, but doesn't have permission! If this was you, Check your config.json"); console.error('[SYSTEM] [ERR] User ' + user.username + " tried to shut down the bot, but doesn't have permission! If this was you, Check your config.json");
return client.generateErrorMessage('Only the bot owner can stop the bot! Stop.', user.displayAvatarURL()); await channel.send(client.generateErrorMessage('You do not have permission to run this command.', user.displayAvatarURL()));
} }
} }
}; };

View File

@ -24,7 +24,7 @@ module.exports = {
handle (client, config, user, target) { handle (client, config, user, target) {
return { return {
embeds: [{ 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, color: 9442302,
footer: { footer: {
icon_url: user.displayAvatarURL(), icon_url: user.displayAvatarURL(),

View File

@ -2,12 +2,12 @@
"prefix": "n!", "prefix": "n!",
"token": "IM SO EXCITED ABOUT BURGER", "token": "IM SO EXCITED ABOUT BURGER",
"ownerID": "MY FAVORITE COLOR IS TWELVE", "ownerID": "MY FAVORITE COLOR IS TWELVE",
"release": "anitrox_dev", "release": "Stable Release",
"build": "Stable", "build": "1.2.2",
"footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022", "footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022",
"sandbox": { "sandbox": {
"enabled": false, "enabled": false,
"id": "788391989460205571", "id": "793537380330111028",
"refreshLocal": false, "refreshLocal": false,
"refreshGlobal": false "refreshGlobal": false
}, },

View File

@ -46,6 +46,7 @@ module.exports = {
console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/'); console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/');
console.log(' / ___ |/ / / / / /_/ / / /_/ /> < '); console.log(' / ___ |/ / / / / /_/ / / /_/ /> < ');
console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| '); console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| ');
console.log('');
console.log(`${config.release}, ${config.build}`); console.log(`${config.release}, ${config.build}`);
console.log('Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!'); console.log('Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!');
// Statuses // Statuses

7
functions/getTime.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = () => {
const date = new Date();
const timeDate = date.toLocaleDateString();
const time = date.toLocaleTimeString();
return ` ${time} | ${timeDate} `;
};

17
functions/uptime.js Normal file
View File

@ -0,0 +1,17 @@
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);
// 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' : ' minutes');
const seconds = tSecs + (tSecs === 1 ? ' second' : ' seconds');
return `${days}, ${hours}, ${minutes}, ${seconds}`;
};

View File

@ -5,6 +5,8 @@
"main": "start.js", "main": "start.js",
"dependencies": { "dependencies": {
"discord.js": "^13.6.0", "discord.js": "^13.6.0",
"dotenv": "^16.0.1",
"node-fetch": "^3.2.9",
"node-os-utils": "^1.3.2", "node-os-utils": "^1.3.2",
"require-all": "^3.0.0" "require-all": "^3.0.0"
}, },