// command file
public constructor(context: Command.LoaderContext) {
super(context, {
preconditions: ["SuperUsersOnly"]
});
}
// src/preconditions/SuperUsersOnly.ts
export class SuperUsersOnlyPrecondition extends Precondition {
public override async chatInputRun(interaction: ChatInputCommandInteraction, command: ChatInputCommand, context: Precondition.Context) {
const it = await interaction.deferReply();
// simulate a db lookup latency
await delay(3000);
await it.delete();
return this.ok();
}
}
// command file
public constructor(context: Command.LoaderContext) {
super(context, {
preconditions: ["SuperUsersOnly"]
});
}
// src/preconditions/SuperUsersOnly.ts
export class SuperUsersOnlyPrecondition extends Precondition {
public override async chatInputRun(interaction: ChatInputCommandInteraction, command: ChatInputCommand, context: Precondition.Context) {
const it = await interaction.deferReply();
// simulate a db lookup latency
await delay(3000);
await it.delete();
return this.ok();
}
}