mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
fix: Update validators with new types
This commit is contained in:
1 parent
af6bdd4da8
commit
e67d0004b0
7 files changed
+39
-73
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../types/interactionTypes';
|
||||
import { ValidatorParams } from '../types/utilTypes';
|
||||
|
||||
abstract class BaseInteraction {
|
||||
protected getLoggerBase(
|
||||
@@ -38,6 +39,16 @@ abstract class BaseInteraction {
|
||||
});
|
||||
}
|
||||
|
||||
protected validators: ((args: ValidatorParams) => Promise<boolean>)[] = [];
|
||||
|
||||
protected async runValidators(args: ValidatorParams): Promise<void> {
|
||||
for (const validator of this.validators) {
|
||||
if (await validator(args)) {
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract execute(
|
||||
params: BaseInteractionParams
|
||||
): Promise<Message<boolean> | ApplicationCommandOptionChoiceData | void>;
|
||||
|
||||
Reference in new issue
Block a user