This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
anitrox/start.js

66 lines
2.2 KiB
JavaScript
Raw Normal View History

const fs = require('fs');
const Discord = require('discord.js');
2021-08-27 16:15:26 -05:00
const { MessageActionRow, MessageButton } = require('discord.js')
const { statuses, build, release, prefix, token, footerTxt } = require('./config.json');
const os = require("os");
2022-03-17 21:55:08 -05:00
console.log('Starting!')
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);
}
client.on("error", (e) => console.log("[ERROR]" + error(e)));
client.on("warn", (e) => ("[WARN]" + warn(e)));
// Log errors to console.
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!");
});
setInterval(() => {
const index = Math.floor(Math.random() * (statuses.length - 1) + 1);
client.user.setActivity(statuses[index]);
}, 20000);
// Picks a status from the config file
// Begin Command Handler
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(client, message, args, footerTxt, Discord);
} catch (error) {
2021-06-08 21:25:37 -05:00
console.stack
const usr = message.author;
const embed = {
"title": "<:AnitroxError:809651936563429416> **Something went wrong!**",
"description": error.stack,
"color": 13632027,
"footer": {
"icon_url": message.author.displayAvatarURL(),
"text": footerTxt + " | Something went wrong! :("
}
};
message.channel.send({ embed });
// End Command Handler
}
});
client.login(token);