2022-03-26 03:33:18 -05:00
|
|
|
#!/usr/bin/env -S node
|
|
|
|
|
2021-02-11 21:39:01 -06:00
|
|
|
const fs = require('fs');
|
|
|
|
const Discord = require('discord.js');
|
2022-03-17 21:47:23 -05:00
|
|
|
const { statuses, build, release, prefix, token, footerTxt } = require('./config.json');
|
2021-02-25 10:11:54 -06:00
|
|
|
|
2022-03-26 03:58:15 -05:00
|
|
|
const embedFooter = {
|
|
|
|
"icon_url": "https://cdn.discordapp.com/attachments/549707869138714635/793524910172667964/Screenshot_26.png",
|
|
|
|
"text": footerTxt
|
|
|
|
}
|
|
|
|
|
2022-03-17 21:55:08 -05:00
|
|
|
console.log('Starting!')
|
2021-02-11 21:39:01 -06:00
|
|
|
const client = new Discord.Client();
|
|
|
|
client.commands = new Discord.Collection();
|
|
|
|
|
|
|
|
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
|
|
|
|
|
|
|
for (const file of commandFiles) {
|
|
|
|
const command = require(`./commands/${file}`);
|
|
|
|
client.commands.set(command.name, command);
|
|
|
|
}
|
|
|
|
|
2022-01-12 00:59:17 -06:00
|
|
|
client.on("error", (e) => console.log("[ERROR]" + error(e)));
|
|
|
|
client.on("warn", (e) => ("[WARN]" + warn(e)));
|
2021-02-11 21:39:01 -06:00
|
|
|
client.once('ready', () => {
|
|
|
|
console.clear()
|
|
|
|
console.log(' ___ _ __ ');
|
|
|
|
console.log(' / | ____ (_) /__________ _ __');
|
|
|
|
console.log(' / /| | / __ \/ / __/ ___/ __ \| |/_/');
|
|
|
|
console.log(' / ___ |/ / / / / /_/ / / /_/ /> < ');
|
|
|
|
console.log('/_/ |_/_/ /_/_/\__/_/ \____/_/|_| ')
|
2021-06-08 21:25:37 -05:00
|
|
|
console.log(release + ", " + build)
|
2022-03-17 21:55:08 -05:00
|
|
|
console.log("All Systems Go. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!");
|
2021-02-11 21:39:01 -06:00
|
|
|
});
|
2022-03-17 21:47:23 -05:00
|
|
|
|
2022-03-26 03:33:18 -05:00
|
|
|
|
2022-03-26 11:02:17 -05:00
|
|
|
setInterval(async () => {
|
2022-03-26 03:33:18 -05:00
|
|
|
// Picks a status from the config file
|
|
|
|
const index = Math.floor(Math.random() * statuses.length);
|
2022-03-26 11:02:17 -05:00
|
|
|
await client.user.setActivity(statuses[index]);
|
2021-02-11 21:39:01 -06:00
|
|
|
}, 20000);
|
2022-03-18 11:04:08 -05:00
|
|
|
|
|
|
|
// Begin Command Handler
|
2022-03-26 03:33:18 -05:00
|
|
|
client.on('message', async (message) => {
|
2021-02-11 21:39:01 -06:00
|
|
|
|
2022-03-18 11:04:08 -05:00
|
|
|
if (!message.content.startsWith(prefix) || message.author.bot) return;
|
2022-03-26 03:33:18 -05:00
|
|
|
|
2021-02-11 21:39:01 -06:00
|
|
|
const args = message.content.slice(prefix.length).split(/ +/);
|
|
|
|
const command = args.shift().toLowerCase();
|
|
|
|
|
|
|
|
if (!client.commands.has(command)) return;
|
|
|
|
|
|
|
|
try {
|
2022-03-26 03:58:15 -05:00
|
|
|
await client.commands.get(command).execute(client, message, args, embedFooter);
|
2021-02-11 21:39:01 -06:00
|
|
|
} catch (error) {
|
2022-03-26 03:33:18 -05:00
|
|
|
console.stack;
|
|
|
|
message.channel.send(new Discord.MessageEmbed({
|
2022-03-17 21:47:23 -05:00
|
|
|
"title": "<:AnitroxError:809651936563429416> **Something went wrong!**",
|
|
|
|
"description": error.stack,
|
2021-02-11 21:39:01 -06:00
|
|
|
"color": 13632027,
|
2022-03-26 03:58:15 -05:00
|
|
|
"footer": footer
|
2022-03-26 03:33:18 -05:00
|
|
|
}));
|
2021-02-11 21:39:01 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-17 21:47:23 -05:00
|
|
|
client.login(token);
|