INNER CODE UNIT · JavaScript
sealedFor
nyxxbit/discord-quest-completer · index.js:264
const sealedFor = questId => {
try { return Mods.QuestStore?.getQuest?.(questId)?.trafficMetadataSealed ?? null; }
catch (_) { return null; }
};
// When Discord has blocked quest enrollment for this account, as a Date, otherwise null.
// `QuestStore.questEnrollmentBlockedUntil` comes from the same `/quests/@me` response the
// client already fetches, so reading it costs nothing and adds no request. A block is the
// clearest signal Discord gives that it has taken an interest in the account, and carrying
// on through it is both futile and the worst available response to it.
// Console task keys. Discord groups them as CONSOLE and no desktop client can drive them.
const CONSOLE_ONLY_KEYS = new Set(['PLAY_ON_XBOX', 'PLAY_ON_PLAYSTATION']);
// The task table comes out of Discord's own store, which hands some payloads back as a Map.
// Indexing one of those with [] reads undefined and looks like a quest with no tasks, so
// every read of it goes through these two.
const taskKeys = (tasks) => (tasks instanceof Map ? [...tasks.keys()] : Object.keys(tasks ?? {}));
const taskAt = (tasks, key) => (tasks instanceof Map ? tasks.get(key) : tasks?.[key]);