Skip to content

Instantly share code, notes, and snippets.

@wickstudio
Last active May 14, 2024 18:01
Show Gist options
  • Save wickstudio/45094268e3e2fdab7e0bba5ed9614ecb to your computer and use it in GitHub Desktop.
Save wickstudio/45094268e3e2fdab7e0bba5ed9614ecb to your computer and use it in GitHub Desktop.

Complete Recent Discord Quest

Important Notes:

  • This script no longer works in a browser. You must use the Discord desktop app.
  • You need at least one other person in the voice channel with you for the script to work.

How to use this script:

  1. Accept the quest in User Settings -> Gift Inventory.
  2. Join a voice channel.
  3. Have an alternate account join the same voice channel.
  4. Start streaming any window (e.g., Notepad).
  5. Open Developer Tools by pressing Ctrl+Shift+I.
    • If this doesn't work, download the PTB (Public Test Build) client or use a method to enable DevTools on the stable version.
  6. Navigate to the Console tab.
  7. Copy and paste the following code into the console and press Enter:
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.default?.flushWaitQueue).exports.default;

let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
let isApp = navigator.userAgent.includes("Electron/")
if(!isApp) {
	console.log("This no longer works in browser. Use the desktop app!")
} else if(!quest) {
	console.log("You don't have any uncompleted quests!")
} else {
	let pid = Math.floor(Math.random() * 30000) + 1000
	ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
		id: quest.config.applicationId,
		pid,
		sourceName: null
	})
	
	let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
	let fn = data => {
		let progress = data.userStatus.streamProgressSeconds
		console.log(`Quest progress: ${progress}/${secondsNeeded}`)
		
		if(progress >= secondsNeeded) {
			console.log("Quest completed!")
			FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
		}
	}
	FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
	
	console.log(`Spoofed your stream to ${quest.config.applicationName}. Stay in vc for ${Math.ceil(quest.config.streamDurationRequirementMinutes - (quest.userStatus?.streamProgressSeconds ?? 0) / 60)} more minutes.`)
	console.log("Remember that you need at least 1 other person to be in the vc!")
}
  1. Keep the stream running for the required duration (usually 15 minutes).
  2. Once the quest is completed, claim the reward in User Settings -> Gift Inventory.

Monitoring Progress:

  • Check the Quest progress: messages in the Console tab.
  • Reopen the Gift Inventory tab in User Settings to see the updated progress.
  • Progress should update every 30 seconds.

FAQ: Q: I get an error saying "Unauthorized". A: Discord has patched the script from working in browsers. Use the desktop app, or find an extension that allows you to change your User-Agent and append Electron/ anywhere in it. Additionally, ensure that at least one other person is in the voice channel with you.

Q: I get a different error. A: Make sure you started streaming before running the script and that you're copying/pasting the code correctly.

For any support, join discord.gg/wicks

@mo2lah
Copy link

mo2lah commented May 14, 2024

TBKTTY27EK2P : code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment