implement canExecDevCommands todo for eval
parent
fdaeeec513
commit
ba6c9218c1
|
@ -2,10 +2,11 @@ import DiscordInteractionCommand from "../../util/DiscordInteractionCommand";
|
|||
import { ChatInputCommandInteraction } from "discord.js";
|
||||
import { inspect } from "util";
|
||||
import { discordBotToken } from "../../config.json";
|
||||
import { PartnerModel } from "../../database/Partner";
|
||||
|
||||
export default class Eval extends DiscordInteractionCommand {
|
||||
// This is a list of IDs that are allowed to use this command.
|
||||
private listOfAllowedIDs: string[];
|
||||
private listOfAllowedIDs: string[] = [];
|
||||
|
||||
constructor() {
|
||||
super("eval", "Executes arbitrary JS code and returns the output.");
|
||||
|
@ -25,10 +26,13 @@ export default class Eval extends DiscordInteractionCommand {
|
|||
option.setName("depth").setDescription("The depth of the inspection.").setRequired(false)
|
||||
);
|
||||
|
||||
// TODO: replace with database entry "canExecuteDevCommands"
|
||||
this.listOfAllowedIDs = [
|
||||
"278620217221971968", // Matthew
|
||||
];
|
||||
// this checks against the database and adds all of the partners that are "allowed to perform dev commands"
|
||||
// doing the database check in the initialization prevents us from having to check the database every time this command is ran
|
||||
PartnerModel.find({ canPerformDevCommands: true }).then((partners) => {
|
||||
for (const partner of partners) {
|
||||
this.listOfAllowedIDs.push(partner.discordID as string);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async execute(interaction: ChatInputCommandInteraction) {
|
||||
|
|
Loading…
Reference in New Issue