UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

46 lines (44 loc) 1.44 kB
import { __name } from '../../../../chunk-PAWJFY3S.mjs'; // src/lib/utils/application-commands/compute-differences/contexts.ts function* checkInteractionContextTypes(existingContexts, newContexts) { if (!existingContexts && newContexts?.length) { yield { key: "contexts", original: "no contexts present", expected: "contexts present" }; } else if (existingContexts?.length && !newContexts?.length) { yield { key: "contexts", original: "contexts present", expected: "no contexts present" }; } else if (newContexts?.length) { let index = 0; for (const newContext of newContexts) { const currentIndex = index++; if (existingContexts[currentIndex] !== newContext) { yield { key: `contexts[${currentIndex}]`, original: `contexts type ${existingContexts?.[currentIndex]}`, expected: `contexts type ${newContext}` }; } } if (index < existingContexts.length) { let type; while ((type = existingContexts[index]) !== void 0) { yield { key: `contexts[${index}]`, original: `context ${type} present`, expected: `no context present` }; index++; } } } } __name(checkInteractionContextTypes, "checkInteractionContextTypes"); export { checkInteractionContextTypes }; //# sourceMappingURL=contexts.mjs.map //# sourceMappingURL=contexts.mjs.map