Feature/23 migrate to typescript #73
3 changed files with 18 additions and 11 deletions
|
@ -20,12 +20,13 @@ FOLDERS_EVENTS=src/events
|
|||
COMMANDS_DISABLED=
|
||||
COMMANDS_DISABLED_MESSAGE=This command is disabled.
|
||||
|
||||
COMMANDS_MUTE_ROLE=Muted
|
||||
COMMANDS_ROLE_ROLES=Notify,VotePings,ProjectUpdates
|
||||
|
||||
EMBED_COLOUR=0x3050ba
|
||||
EMBED_COLOUR_ERROR=0xD52803
|
||||
|
||||
ROLES_MODERATOR=Moderator
|
||||
ROLES_MUTED=Muted
|
||||
|
||||
CHANNELS_LOGS_MESSAGE=message-logs
|
||||
CHANNELS_LOGS_MEMBER=member-logs
|
||||
|
|
|
@ -54,7 +54,7 @@ export default class Mute extends Command {
|
|||
const publicEmbed = new PublicEmbed(context, "", `${targetUser} has been muted`);
|
||||
publicEmbed.AddReason(reason);
|
||||
|
||||
const mutedRole = context.message.guild.roles.cache.find(role => role.name == process.env.COMMANDS_MUTE_ROLE);
|
||||
const mutedRole = context.message.guild.roles.cache.find(role => role.name == process.env.ROLES_MUTED);
|
||||
|
||||
if (!mutedRole) {
|
||||
const embed = new ErrorEmbed(context, ErrorMessages.RoleNotFound);
|
||||
|
|
|
@ -3,16 +3,22 @@ import * as dotenv from "dotenv";
|
|||
|
||||
dotenv.config();
|
||||
|
||||
// Ensure required data is in dotenv
|
||||
if (!process.env.EMBED_COLOUR) throw "EMBED_COLOUR is required in .env";
|
||||
if (!process.env.EMBED_COLOUR_ERROR) throw "EMBED_COLOUR_ERROR is required in .env";
|
||||
const requiredConfigs = [
|
||||
"EMBED_COLOUR",
|
||||
"EMBED_COLOUR_ERROR",
|
||||
"ROLES_MODERATOR",
|
||||
"ROLES_MUTED",
|
||||
"CHANNELS_LOGS_MESSAGE",
|
||||
"CHANNELS_LOGS_MEMBER",
|
||||
"CHANNELS_LOGS_MOD",
|
||||
"COMMANDS_ROLE_ROLES"
|
||||
];
|
||||
|
||||
if (!process.env.ROLES_MODERATOR) throw "ROLES_MODERATOR is required in .env";
|
||||
|
||||
if (!process.env.CHANNELS_LOGS_MESSAGE) throw "CHANNELS_LOGS_MESSAGE is required in .env";
|
||||
if (!process.env.CHANNELS_LOGS_MEMBER) throw "CHANNELS_LOGS_MEMBER is required in .env";
|
||||
if (!process.env.CHANNELS_LOGS_MOD) throw "CHANNELS_LOGS_MOD is required in .env";
|
||||
if (!process.env.COMMANDS_MUTE_ROLE) throw "COMMANDS_MUTE_ROLE is required in .env";
|
||||
requiredConfigs.forEach(config => {
|
||||
if (!process.env[config]) {
|
||||
throw `${config} is required in .env`;
|
||||
}
|
||||
});
|
||||
|
||||
const client = new CoreClient();
|
||||
client.start();
|
Loading…
Reference in a new issue