Disclaimer: This is just a purely cosmetical change of the gist by aamiaa
Note
This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string Electron/ anywhere in your user-agent.
Note
This no longer works if you're alone in vc! Somebody else has to join you!
Tip
If there is no other person available to be in the vc with you, you can do it with a second account using either Discord in your browser or Discord PTB (or the normal Discord Client if you're using the PTB build for opening the DevTools)
How to use this script:
- Accept the quest under User Settings -> Gift Inventory
- Join a vc
- Join the same vc on an alt
- Stream any window (can be notepad or something)
- Press Ctrl+Shift+I to open DevTools
- Go to the
Consoletab - Paste the following code and hit enter:
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
let VoiceStateStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentClientVoiceChannelId).exports.default;
let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
let encodeStreamKey = Object.values(wpRequire.c).find(x => x?.exports?.encodeStreamKey).exports.encodeStreamKey;
let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
let streamData = ApplicationStreamingStore.getCurrentUserActiveStream()
let isApp = navigator.userAgent.includes("Electron/")
let isAloneInVC = streamData && Object.keys(VoiceStateStore.getVoiceStatesForChannel(streamData.channelId)).length === 1
if(!isApp) {
console.log('%c[DiscordQuestCompleter] %cThis no longer works in browser. Use the desktop app!', 'color: #bada55', 'font-weight: bold; color: #e54141');
} else if(!quest) {
console.log("%c[DiscordQuestCompleter] %cYou don't have any uncompleted quests!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
} else if(!streamData) {
console.log("%c[DiscordQuestCompleter] %cYou haven't started a stream!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
} else if(isAloneInVC) {
console.log("%c[DiscordQuestCompleter] %cYou need to join the vc on 1 other account!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
} else {
let streamId = encodeStreamKey(streamData)
let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
let getProgressionColorCode = (percentage) => {
if(percentage < 25) return "#fb4b4b"
if(percentage < 50) return "#ffa879"
if(percentage < 75) return "#ffc163"
if(percentage < 100) return "#feff5c"
return "#c0ff33"
}
let heartbeat = async function() {
console.log(`%c[DiscordQuestCompleter] %cCompleting quest ${quest.config.messages.gameTitle} - ${quest.config.messages.questName}`, 'color: #bada55', '');
while(true) {
let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}, headers: {"X-Discord-Resource-Optimization-Level": "1"}})
let progress = res.body.stream_progress_seconds
progressPercentage = ((progress / secondsNeeded) * 100 | 0);
console.log(`%c[DiscordQuestCompleter] %cQuest Progress ${progress}/${secondsNeeded} [ %c${progressPercentage + "%"} %c]`, 'color: #bada55', '', `color: ${getProgressionColorCode(progressPercentage)}`, '');
if(progress >= secondsNeeded) break;
await sleep(30 * 1000)
}
console.log("%c[DiscordQuestCompleter] %cQuest completed!", 'color: #bada55', 'color: #44d618');
}
heartbeat()
}- Keep the stream running for 15 minutes
- You can now claim the reward in User Settings -> Gift Inventory!
You can track the progress by looking at the Quest progress: prints in the Console tab, or by reopening the Gift Inventory tab in settings. The progress should update every 30s.
Q: Ctrl + Shift + I doesn't work
A: Either download the ptb client, or use this to enable DevTools on stable
Q: I get an error saying "Unauthorized"
A: Discord has patched the script from working in browsers. Use the desktop app, or alternatively find some extension which lets you change your User-Agent and append the string Electron/ anywhere in it.
They have also started checking how many people are in the vc, so make sure you join it on at least 1 other account.
Q: I get a different error
A: Make sure you've started streaming before running the script. Also make sure you're copy/pasting it correctly.

