Merge branch 'dev' of github.com:IDeletedSystem64/anitrox into dev

This commit is contained in:
Nathaniel Mason 2022-03-29 19:43:19 +01:00
commit 752e6728bb
8 changed files with 103 additions and 104 deletions

View File

@ -1,47 +1,27 @@
const answers = [
"Heck no!",
"Are you crazy!? No!",
"Don't even think about it.",
"No! You might bork something!",
"Heck yeah",
"I don't think so.",
"Let me think about it first. No.",
"Let me think about it first. Yeah",
"Let me think about it first. Maybe",
"I don't know man",
"Maybe",
"I'm not sure",
"Ask again",
"YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!",
"Definitely!",
"Go for it! :smile:",
"Good idea!",
"Sure"
]
module.exports = { module.exports = {
name: '8ball', name: '8ball',
description: 'Ask Anitrox a question, any question! and they will answer it!', description: 'Ask Anitrox a question, any question! and they will answer it!',
syntax: ["[Question]"], syntax: ["[Question]"],
async execute(client, message, args, footerTxt) { async execute(client, message, args, config) {
const answer = answers[Math.floor(Math.random() * Object.keys(answers).length)]; const index = Math.floor(Math.random() * config.answers.length);
const answer = config.answers[index]
const question = args.slice(0).join(" ") const question = args.slice(0).join(" ")
if (!question) { if (!question) {
await message.channel.send(client.generateErrorMessage("You need to ask a question!", message.author.displayAvatarURL)); await message.channel.send(client.generateErrorMessage("You need to ask a question!", message.author.displayAvatarURL));
} else { } else {
await message.channel.send({embed: { await message.channel.send({embed: {
"title": ":8ball: Anitrox 8 Ball", "title": ":8ball: 8Ball",
"description": `Your question: **${question}**`, "description": `Your amazing question: **${question}**`,
"color": 9442302, "color": 9442302,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
}, },
"fields": [ "fields": [
{ {
"name": "🤔 My Answer", "name": "Answer",
"value": answer "value": `${answer}`
} }
] ]
}}); }});

View File

@ -1,22 +1,21 @@
const { inspect } = require("util"); const { inspect } = require("util");
module.exports = { module.exports = {
name: 'eval', name: 'eval',
description: 'Runs js code', description: 'Executes JS code',
async execute(_, message, args, footerTxt) { async execute(_, message, args, config) {
if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { if (message.author.id == config.ownerID) {
try { try {
const code = args.join(" "); const code = args.join(" ");
const evaled = inspect(eval(code)); const evaled = inspect(eval(code));
await message.channel.send(evaled, {code:"xl"}); await message.channel.send(evaled, {code:"xl"});
} catch (error) { } catch (error) {
await message.channel.send({embed: { await message.channel.send({embed: {
"title": "<:NyabotError:697145462347661412> **Well that happened...**", "title": "<:AnitroxError:809651936563429416> **Something went wrong! **",
"color": 13632027, "color": 13632027,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
}, },
"fields": [ "fields": [
{ {

View File

@ -14,10 +14,10 @@ module.exports = {
const minutes = parseInt((totalSeconds % 3600) / 60); const minutes = parseInt((totalSeconds % 3600) / 60);
const seconds = parseInt(totalSeconds % 60); const seconds = parseInt(totalSeconds % 60);
const daystring = days + (days === 1 ? "day" : "days"); const daystring = days + (days === 1 ? " day" : " days");
const hourstring = hours + (hours === 1 ? "day" : "days"); const hourstring = hours + (hours === 1 ? " hour" : " hours");
const minutetring = minutes + (minutes === 1 ? "day" : "days"); const minutetring = minutes + (minutes === 1 ? " minute" : " minutes");
const secondstring = seconds + (seconds === 1 ? "day" : "days"); const secondstring = seconds + (seconds === 1 ? " second" : " seconds");
return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`; return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`;
} }

View File

@ -1,19 +1,17 @@
const { locations } = require('../config.json');
module.exports = { module.exports = {
name: "ping", name: "ping",
description: "Gets bot ping", description: "Gets bot ping",
async execute(client, message, _, footerTxt) { async execute(client, message, args, config) {
const index = Math.floor(Math.random() * locations.length); const index = Math.floor(Math.random() * config.locations.length);
const pingLocation = locations[index] const location = config.locations[index]
await message.channel.send({embed:{ await message.channel.send({embed:{
"title": ":ping_pong: Ping", "title": ":ping_pong: Ping",
"description": `**Pong!** We pinged **${pingLocation}** and got ${client.ws.ping} ms.`, "description": `**Pong!** We pinged **${location}** and got ${client.ws.ping} ms.`,
"color": 9442302, "color": 9442302,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
} }
}}); }});
} }

View File

@ -1,8 +1,8 @@
module.exports = { module.exports = {
name: 'reload', name: 'reload',
description: 'Reloads a command', description: 'Reloads a command',
async execute(client, message, args, footerTxt) { async execute(client, message, args, config) {
if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { if (message.author.id = config.ownerID) {
if (!args.length) { if (!args.length) {
await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock",message.author.displayAvatarURL())); await message.channel.send(client.generateErrorMessage("You forgot to provide anything to reload, you pillock",message.author.displayAvatarURL()));
} }
@ -19,7 +19,7 @@ module.exports = {
try { try {
const newCommand = require(`./${command.name}.js`); const newCommand = require(`./${command.name}.js`);
client.commands.set(newCommand.name, newCommand); client.commands.set(newCommand.name, newCommand);
await message.channel.send(`<:NyabotSuccess:697211376740859914> **Reloaded \`${command.name}\` successfully!**`); await message.channel.send(`<:AnitroxSuccess:809651936819019796> **Reloaded \`${command.name}\` successfully!**`);
console.log(`User reloaded ${command.name}.`) console.log(`User reloaded ${command.name}.`)
} catch (error) { } catch (error) {
console.error(error); console.error(error);
@ -30,7 +30,7 @@ module.exports = {
} else { } else {
message.channel.send({embed: { message.channel.send({embed: {
"title": "<:NyabotDenied:697145462565896194> **Access is denied**", "title": "<:AnitroxDenied:809651936642203668> **403 Forbidden**",
"color": 13632027, "color": 13632027,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),

View File

@ -1,26 +1,27 @@
module.exports = { module.exports = {
name: "stop", name: "stop",
description: "Stops the bot", description: "IT'S TIME TO STOP!... the bot",
async execute(client, message, _, footerTxt) { async execute(client, message, config) {
if (message.author.id == 309427567004483586 || message.author.id == 475558313376088064) { if (message.author.id == config.ownerID) {
await message.channel.send({embed: { await message.channel.send({embed: {
"title": "<a:AnitroxWorking:697147309531594843> **Shutting Down...**", "title": "<a:AnitroxWorking:697147309531594843> **Shutting Down...**",
"description": "See you next time!", "description": "See you next time!",
"color": 9442302, "color": 9442302,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
}, },
}}); }});
client.destroy(); console.log("The bot is shutting down! Bye bye!")
process.exit();
} else { } else {
await message.channel.send({embed: { await message.channel.send({embed: {
"title": ":AnitroxDenied: Access Denied", "title": "<:AnitroxDenied:809651936642203668> 403 Forbidden",
"description": "You need to be the bot owner to execute this command!", "description": "You need to be the bot owner to execute this command!",
"color": 13632027, "color": 13632027,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
}, },
}}); }});
} }

View File

@ -21,17 +21,37 @@
"VLC Media Player", "VLC Media Player",
"Chromium" "Chromium"
], ],
"locations": [ "locations": [
"Microsoft", "Microsoft",
"LinusTechTips", "LinusTechTips",
"Linus Torvalds", "Linus Torvalds",
"borkeonv2", "borkeonv2",
"Google", "Google",
"192.168.1.1", "192.168.1.1",
"127.0.0.1", "127.0.0.1",
"Sophie's computer", "Sophie's computer",
"Mars", "Mars",
"Elon Musk", "Elon Musk",
"TMC Software" "TMC Software"
],
"answers": [
"Heck no!",
"Are you crazy!? No!",
"Don't even think about it.",
"No! You might bork something!",
"Heck yeah",
"I don't think so.",
"Let me think about it first. No.",
"Let me think about it first. Yeah",
"Let me think about it first. Maybe",
"I don't know man",
"Maybe",
"I'm not sure",
"Ask again",
"YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!",
"Definitely!",
"Go for it! :smile:",
"Good idea!",
"Sure"
] ]
} }

View File

@ -2,8 +2,8 @@
const fs = require('fs'); const fs = require('fs');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { statuses, build, release, prefix, token, footerTxt } = require('./config.json'); // const { statuses, build, release, prefix, token, footerTxt } = require('./config.json');
const config = require('./config.json');
console.log('Starting!') console.log('Starting!')
const client = new Discord.Client(); const client = new Discord.Client();
client.commands = new Discord.Collection(); client.commands = new Discord.Collection();
@ -20,11 +20,11 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: {
"color": 13632027, "color": 13632027,
"footer": { "footer": {
"icon_url": messageAuthorURL, "icon_url": messageAuthorURL,
"text": footerTxt "text": config.footerTxt
}, },
"fields": [ "fields": [
{ {
"name": "Well that happened...", "name": "Something went wrong!",
"value": errorMsg "value": errorMsg
} }
] ]
@ -33,47 +33,48 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: {
client.on("error", (e) => console.log(`[ERROR] ${error(e)}`)); client.on("error", (e) => console.log(`[ERROR] ${error(e)}`));
client.on("warn", (e) => (`[WARN] ${warn(e)}`)); client.on("warn", (e) => (`[WARN] ${warn(e)}`));
client.once('ready', () => { client.once('ready', () => {
console.clear() console.clear()
console.log(' ___ _ __ '); console.log(' ___ _ __ ');
console.log(' / | ____ (_) /__________ _ __'); console.log(' / | ____ (_) /__________ _ __');
console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/'); console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/');
console.log(' / ___ |/ / / / / /_/ / / /_/ /> < '); console.log(' / ___ |/ / / / / /_/ / / /_/ /> < ');
console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| '); console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| ');
console.log(`${release}, ${build}`); console.log(`${config.release}, ${config.build}`);
console.log("All Systems Go. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!"); console.log("Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!");
// Statuses
setInterval(async () => {
// Picks a status from the config file
const index = Math.floor(Math.random() * config.statuses.length);
await client.user.setActivity(config.statuses[index]);
}, 20000);
}); });
setInterval(async () => {
// Picks a status from the config file
const index = Math.floor(Math.random() * statuses.length);
await client.user.setActivity(statuses[index]);
}, 20000);
// Begin Command Handler // Begin Command Handler
client.on('message', async (message) => { client.on('message', async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return; if (!message.content.startsWith(config.prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/); const args = message.content.slice(config.prefix.length).split(/ +/);
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return; if (!client.commands.has(command)) return;
try { try {
await client.commands.get(command).execute(client, message, args, footerTxt); await client.commands.get(command).execute(client, message, args, config);
} catch (error) { } catch (error) {
console.stack; console.stack;
message.channel.send({embed: { message.channel.send({embed: {
"title": "<:AnitroxError:809651936563429416> **Something went wrong!**", "title": "<:AnitroxError:809651936563429416> **Something went wrong!**",
"description": error.stack, "description": error.stack,
"color": 13632027, "color": 13632027,
"footer": { "footer": {
"icon_url": message.author.displayAvatarURL(), "icon_url": message.author.displayAvatarURL(),
"text": footerTxt "text": config.footerTxt
}, },
}}); }});
} }
}); });
client.login(token); client.login(config.token);