INNER CODE UNIT · JavaScript
questBlocker
nyxxbit/discord-quest-completer · index.js:316
const questBlocker = ({ name, hasTaskConfig, keys, typeData, isDesktop }) => {
if (!hasTaskConfig) return `"${name}" has no usable task config, so there is nothing to drive.`;
if (!typeData) {
if (!keys.length) return `"${name}" lists no tasks at all, so there is nothing to drive.`;
if (keys.every(k => CONSOLE_ONLY_KEYS.has(k))) return `"${name}" is console-only (${keys.join(', ')}), so no desktop client can run it.`;
// The reason belongs to one key, so a quest carrying several says which one it
// explains rather than attaching the sentence to the whole list.
const named = keys.find(k => UNAUTOMATABLE_KEYS.has(k));
if (named) {
return keys.length === 1
? `"${name}" offers only ${named}. ${UNAUTOMATABLE_KEYS.get(named)}`
: `"${name}" offers ${keys.join(', ')}, and none of them run here. The one we know about is ${named}. ${UNAUTOMATABLE_KEYS.get(named)}`;
}
return `"${name}" uses an unsupported task type (${keys.join(', ')}).`;
}