Update commands to check roles per server
This commit is contained in:
parent
d111363c87
commit
1387200c00
17 changed files with 111 additions and 20 deletions
|
@ -12,7 +12,7 @@ export default class Ban extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class Clear extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Guild } from "discord.js";
|
||||
import { readFileSync } from "fs";
|
||||
import { CommandResponse } from "../constants/CommandResponse";
|
||||
import DefaultValues from "../constants/DefaultValues";
|
||||
import { ICommandContext } from "../contracts/ICommandContext";
|
||||
import ICommandReturnContext from "../contracts/ICommandReturnContext";
|
||||
|
@ -13,6 +14,25 @@ export default class Config extends Command {
|
|||
constructor() {
|
||||
super();
|
||||
super._category = "Administration";
|
||||
super._roles = [
|
||||
"administrator"
|
||||
]
|
||||
}
|
||||
|
||||
public override async precheckAsync(context: ICommandContext): Promise<CommandResponse> {
|
||||
if (!context.message.guild) {
|
||||
return CommandResponse.ServerNotSetup;
|
||||
}
|
||||
|
||||
const server = await Server.FetchOneById<Server>(Server, context.message.guild?.id, [
|
||||
"Settings",
|
||||
]);
|
||||
|
||||
if (!server) {
|
||||
return CommandResponse.ServerNotSetup;
|
||||
}
|
||||
|
||||
return CommandResponse.Ok;
|
||||
}
|
||||
|
||||
public override async execute(context: ICommandContext) {
|
||||
|
@ -25,8 +45,6 @@ export default class Config extends Command {
|
|||
]);
|
||||
|
||||
if (!server) {
|
||||
const embed = new ErrorEmbed(context, "This server hasn't been setup yet, please run the setup command");
|
||||
embed.SendToCurrentChannel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class Kick extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class Mute extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ export default class Rules extends Command {
|
|||
|
||||
super._category = "Admin";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"administrator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ export default class Setup extends Command {
|
|||
constructor() {
|
||||
super();
|
||||
super._category = "Administration";
|
||||
super._roles = [
|
||||
"moderator"
|
||||
]
|
||||
}
|
||||
|
||||
public override async execute(context: ICommandContext) {
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class Unmute extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class Warn extends Command {
|
|||
|
||||
super._category = "Moderation";
|
||||
super._roles = [
|
||||
process.env.ROLES_MODERATOR!
|
||||
"moderator"
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue