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)
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!
# Anitrox Stable Branch (anitrox_stable)
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);

View File

@ -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));

View File

@ -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: '<Command>',
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<Option> OPTIONAL' }
]
}]
};

View File

@ -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 minutetring = minutes + (minutes === 1 ? ' minute' : ' minutes');
const secondstring = seconds + (seconds === 1 ? ' second' : ' seconds');
return `${daystring}**, **${hourstring}**, **${minutetring}**, **${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(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 }
]
}]
};
}
};

View File

@ -47,22 +47,8 @@ module.exports = {
return returnMessage;
} else {
return {
embeds: [{
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!"
}
]
}]
};
console.error(`[SYSTEM] [ERR] User ${user.username} tried to reload ${args[0]}, but doesn't have permission!`);
return client.generateErrorMessage("You don't have permission to run this command.", user.displayAvatarURL());
}
}
};

View File

@ -43,7 +43,7 @@ module.exports = {
} catch (e) { console.error(e); }
} 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");
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: [],
async parseMessage (client, config, message) {
await message.channel.send(await this.handle(client, config, message.author));
process.exit();
await this.handle(client, config, message.author, message.channel);
},
async parseInteraction (client, config, interaction) {
await interaction.reply(await this.handle(client, config, interaction.user));
process.exit();
await this.handle(client, config, interaction.user, interaction.channel);
},
async handle (client, config, user) {
async handle (client, config, user, channel) {
if (user.id === config.ownerID) {
console.log('[SYSTEM] [INFO] ' + ` The bot is going down for shut down. \nShutdown requested by ${user.username}`);
return {
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: '<a:AnitroxWorking:697147309531594843> **Shutting Down...**',
@ -27,10 +25,11 @@ module.exports = {
text: config.footerTxt
}
}]
};
});
process.exit();
} 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");
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) {
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(),

View File

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

View File

@ -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

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",
"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"
},