2021-03-31 07:00:03 +00:00
|
|
|
import "./modules/globals";
|
2021-04-05 09:26:33 +00:00
|
|
|
import {Client, Permissions} from "discord.js";
|
2021-04-10 07:38:46 +00:00
|
|
|
import path from "path";
|
2021-01-29 19:14:31 +00:00
|
|
|
|
2020-07-25 11:01:24 +00:00
|
|
|
// This is here in order to make it much less of a headache to access the client from other files.
|
|
|
|
// This of course won't actually do anything until the setup process is complete and it logs in.
|
2021-03-31 02:19:04 +00:00
|
|
|
export const client = new Client();
|
2020-10-20 19:10:03 +00:00
|
|
|
|
2021-04-13 12:38:52 +00:00
|
|
|
import {launch} from "onion-lasers";
|
2021-04-10 07:38:46 +00:00
|
|
|
import setup from "./modules/setup";
|
|
|
|
import {Config, getPrefix} from "./structures";
|
|
|
|
import {toTitleCase} from "./lib";
|
|
|
|
|
2021-03-31 02:56:25 +00:00
|
|
|
// Send the login request to Discord's API and then load modules while waiting for it.
|
2020-07-25 11:01:24 +00:00
|
|
|
setup.init().then(() => {
|
2020-12-15 01:44:28 +00:00
|
|
|
client.login(Config.token).catch(setup.again);
|
2020-10-15 09:23:24 +00:00
|
|
|
});
|
2021-03-31 02:56:25 +00:00
|
|
|
|
2021-04-05 09:26:33 +00:00
|
|
|
// Setup the command handler.
|
2021-04-10 07:38:46 +00:00
|
|
|
launch(client, path.join(__dirname, "commands"), {
|
|
|
|
getPrefix,
|
|
|
|
categoryTransformer: toTitleCase,
|
2021-04-05 09:26:33 +00:00
|
|
|
permissionLevels: [
|
|
|
|
{
|
|
|
|
// NONE //
|
|
|
|
name: "User",
|
|
|
|
check: () => true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// MOD //
|
|
|
|
name: "Moderator",
|
|
|
|
check: (_user, member) =>
|
|
|
|
!!member &&
|
|
|
|
(member.hasPermission(Permissions.FLAGS.MANAGE_ROLES) ||
|
|
|
|
member.hasPermission(Permissions.FLAGS.MANAGE_MESSAGES) ||
|
|
|
|
member.hasPermission(Permissions.FLAGS.KICK_MEMBERS) ||
|
|
|
|
member.hasPermission(Permissions.FLAGS.BAN_MEMBERS))
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// ADMIN //
|
|
|
|
name: "Administrator",
|
|
|
|
check: (_user, member) => !!member && member.hasPermission(Permissions.FLAGS.ADMINISTRATOR)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// OWNER //
|
|
|
|
name: "Server Owner",
|
|
|
|
check: (_user, member) => !!member && member.guild.ownerID === member.id
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// BOT_SUPPORT //
|
|
|
|
name: "Bot Support",
|
|
|
|
check: (user) => Config.support.includes(user.id)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// BOT_ADMIN //
|
|
|
|
name: "Bot Admin",
|
|
|
|
check: (user) => Config.admins.includes(user.id)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// BOT_OWNER //
|
|
|
|
name: "Bot Owner",
|
|
|
|
check: (user) => Config.owner === user.id
|
|
|
|
}
|
2021-04-10 07:38:46 +00:00
|
|
|
]
|
2021-04-05 09:26:33 +00:00
|
|
|
});
|
|
|
|
|
2021-03-31 02:56:25 +00:00
|
|
|
// Initialize Modules //
|
2021-04-05 04:35:12 +00:00
|
|
|
import "./modules/ready";
|
2021-03-31 07:00:03 +00:00
|
|
|
import "./modules/presence";
|
2021-03-31 02:56:25 +00:00
|
|
|
import "./modules/lavalink";
|
|
|
|
import "./modules/emoteRegistry";
|
2021-04-08 21:43:58 +00:00
|
|
|
import "./modules/systemInfo";
|
2021-04-01 10:44:44 +00:00
|
|
|
import "./modules/intercept";
|
|
|
|
import "./modules/messageEmbed";
|
2021-04-05 12:21:27 +00:00
|
|
|
import "./modules/guildMemberAdd";
|
2021-04-07 06:43:39 +00:00
|
|
|
import "./modules/streamNotifications";
|
2021-04-26 11:16:37 +00:00
|
|
|
import "./modules/channelDefaults";
|
2021-05-08 13:32:45 +00:00
|
|
|
// This module must be loaded last for the dynamic event reading to work properly.
|
|
|
|
import "./modules/eventLogging";
|