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';

if (someCondition) return;
...
Jump to solution
1 Reply
Solution
Favna
Favna2y ago
import { someCondition } from '../lib/utils/someCondition';

if (someCondition) return;
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(...);
}
}
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
Want results from more Discord servers?
Add your server