implement canExecDevCommands todo for eval

dev
Matthew 2024-11-17 00:58:09 -05:00
parent fdaeeec513
commit ba6c9218c1
Signed by: matthew
SSH Key Fingerprint: SHA256:piIXekA9q1p0ZGi4ogFbNY1embip5Ytbi3v8AZ8UYq4
1 changed files with 9 additions and 5 deletions

View File

@ -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) {