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