INNER CODE UNIT · JavaScript
notExpired
nyxxbit/discord-quest-completer · index.js:184
const notExpired = q => {
try {
const store = Mods.QuestStore;
if (typeof store?.isQuestExpired === 'function') return store.isQuestExpired(q.id) !== true;
} catch (_) { /* fall through to the timestamp */ }
const e = new Date(q.config?.expiresAt ?? 0).getTime();
return Number.isNaN(e) || e > Date.now();
};
// Orbs a quest pays out, as { orbs, premium }, or null when it pays none. Every reward entry
// is summed. The quantity sits on the entry and a quest can list several, so reading
// rewards[0] reports no Orbs at all for a quest that lists an in-game item first.
// premiumOrbQuantity is the figure for an account Discord boosts (Nitro or Xbox Game Pass)
// and is sometimes absent or equal, so it falls back to the base number rather than being
// multiplied here.
const orbReward = config => {
const rewards = config?.rewardsConfig?.rewards;
if (!Array.isArray(rewards)) return null;