Where am I going wrong, trying to use this precondition? **GmOnly.ts** ```ts export class Precondi

Where am I going wrong, trying to use this precondition?

GmOnly.ts
export class PreconditionGmOnly extends Precondition {
    public run(message: Message, command: Command): PreconditionResult {
        const hasGmRole = message.member.roles.cache.find((r) => r.id == process.env.GM_ROLE_ID);

        if (hasGmRole) {
            return this.ok();
        } else {
            Logger.warn(`${message.member} tried to use ${command.name}, but is not a GM!`, "GM Command Restricted", message);

            return this.error({ message: `🚨 ${message.member} - You do not have the required permissions to use this command` });
        }
    }
}

declare module "@sapphire/framework" {
    interface Preconditions {
        GmOnly: never;
    }
}


Foo.ts
@ApplyOptions<CommandOptions>({
    aliases: ["!foo"],
    preconditions: ["GmOnly"],
})
export class FooCommand extends Command {
    public async messageRun(message: Message, args: Args): Promise<Message> {
        return message.reply("bar");
    }
}


2022-04-22 18:35:43 - ERROR - Encountered error on event listener "CorePreCommandRun" for event "preCommandRun" at path "D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\listeners\command-handler\CorePreCommandRun.js" Error: The precondition "GmOnly" is not available.
2022-04-22 18:35:43 - ERROR -     at PreconditionContainerSingle.run (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\lib\utils\preconditions\PreconditionContainerSingle.js:30:15)2022-04-22 18:35:43 - ERROR -     at Object.sequential (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\lib\utils\preconditions\conditions\PreconditionConditionAnd.js:12:40)      
2022-04-22 18:35:43 - ERROR -     at PreconditionContainerArray.run (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\lib\utils\preconditions\PreconditionContainerArray.js:101:30) 
2022-04-22 18:35:43 - ERROR -     at CoreListener.run (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\listeners\command-handler\CorePreCommandRun.js:19:57)
2022-04-22 18:35:43 - ERROR -     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-04-22 18:35:43 - ERROR -     at async fromAsync (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\lib\parsers\Result.js:52:19)
2022-04-22 18:35:43 - ERROR -     at async CoreListener._run (D:\Modern JS\swrpg-bot-v2\node_modules\@sapphire\framework\dist\lib\structures\Listener.js:93:24)
Was this page helpful?