@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
35 lines (33 loc) • 1.51 kB
JavaScript
import { __name } from '../../chunk-PAWJFY3S.mjs';
import { isNullish } from '@sapphire/utilities';
import { Command } from '../structures/Command.mjs';
import { CommandPreConditions } from '../types/Enums.mjs';
function parseConstructorPreConditionsRunIn(runIn, resolveConstructorPreConditionsRunType, preconditionContainerArray) {
if (isNullish(runIn)) return;
if (Command.runInTypeIsSpecificsObject(runIn)) {
const messageRunTypes = resolveConstructorPreConditionsRunType(runIn.messageRun);
const chatInputRunTypes = resolveConstructorPreConditionsRunType(runIn.chatInputRun);
const contextMenuRunTypes = resolveConstructorPreConditionsRunType(runIn.contextMenuRun);
if (messageRunTypes !== null || chatInputRunTypes !== null || contextMenuRunTypes !== null) {
preconditionContainerArray.append({
name: CommandPreConditions.RunIn,
context: {
types: {
messageRun: messageRunTypes ?? [],
chatInputRun: chatInputRunTypes ?? [],
contextMenuRun: contextMenuRunTypes ?? []
}
}
});
}
} else {
const types = resolveConstructorPreConditionsRunType(runIn);
if (types !== null) {
preconditionContainerArray.append({ name: CommandPreConditions.RunIn, context: { types } });
}
}
}
__name(parseConstructorPreConditionsRunIn, "parseConstructorPreConditionsRunIn");
export { parseConstructorPreConditionsRunIn };
//# sourceMappingURL=runIn.mjs.map
//# sourceMappingURL=runIn.mjs.map