Use preconditions outside of the command class

Is there a way to run a precondition check outside of the command class for instance if I wanted to check if someone would pass a precondition in a function
Solution
import { someCondition } from '../lib/utils/someCondition';

if (someCondition) return;


import { someCondition } from '../lib/utils/someCondition';

export class MyPrecondition extends Precondition {
  public override chatIntputRun() {
    if (someCondition) return this.error(...);
    return this.ok(...);
  }
}


preconditions are just glorified if checks
Was this page helpful?