Skip to content

Instantly share code, notes, and snippets.

@aamiaa
Last active January 14, 2025 04:02
Show Gist options
  • Save aamiaa/204cd9d42013ded9faf646fae7f89fbb to your computer and use it in GitHub Desktop.
Save aamiaa/204cd9d42013ded9faf646fae7f89fbb to your computer and use it in GitHub Desktop.
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This does not works in browser for non-video, non-activity quests! For stream/play quests use the desktop app!

Note

When doing stream quests, you need at least 1 other account in the vc!

How to use this script:

  1. Accept a quest under User Settings -> Gift Inventory
  2. Press Ctrl+Shift+I to open DevTools
  3. Go to the Console tab
  4. Paste the following code and hit enter:
Click to expand
delete window.$;
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getStreamerActiveStreamMetadata).exports.Z;
let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getRunningGames).exports.ZP;
let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getQuest).exports.Z;
let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getAllThreadsForParent).exports.Z;
let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getSFWDefaultChannel).exports.ZP;
let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.flushWaitQueue).exports.Z;
let api = Object.values(wpRequire.c).find(x => x?.exports?.tn?.get).exports.tn;

let quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
let isApp = navigator.userAgent.includes("Electron/")
if(!quest) {
	console.log("You don't have any uncompleted quests!")
} else {
	const pid = Math.floor(Math.random() * 30000) + 1000
	
	const applicationId = quest.config.application.id
	const applicationName = quest.config.application.name
	const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY"].find(x => quest.config.taskConfig.tasks[x] != null)
	const secondsNeeded = quest.config.taskConfig.tasks[taskName].target
	const secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0

	if(taskName === "WATCH_VIDEO") {
		const tolerance = 2, speed = 10
		const diff = Math.floor((Date.now() - new Date(quest.userStatus.enrolledAt).getTime())/1000)
		const startingPoint = Math.min(Math.max(Math.ceil(secondsDone), diff), secondsNeeded)
		let fn = async () => {
			for(let i=startingPoint;i<=secondsNeeded;i+=speed) {
				try {
					await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, i + Math.random())}})
				} catch(ex) {
					console.log("Failed to send increment of", i, ex.message)
				}
				await new Promise(resolve => setTimeout(resolve, tolerance * 1000))
			}
			if((secondsNeeded-secondsDone)%speed !== 0) {
				await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: secondsNeeded}})
			}
			console.log("Quest completed!")
		}
		fn()
		console.log(`Spoofing video for ${applicationName}. Wait for ${Math.ceil((secondsNeeded - startingPoint)/speed*tolerance)} more seconds.`)
	} else if(taskName === "PLAY_ON_DESKTOP") {
		if(!isApp) {
			console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
		}
		
		api.get({url: `/applications/public?application_ids=${applicationId}`}).then(res => {
			const appData = res.body[0]
			const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
			
			const games = RunningGameStore.getRunningGames()
			const fakeGame = {
				cmdLine: `C:\\Program Files\\${appData.name}\\${exeName}`,
				exeName,
				exePath: `c:/program files/${appData.name.toLowerCase()}/${exeName}`,
				hidden: false,
				isLauncher: false,
				id: applicationId,
				name: appData.name,
				pid: pid,
				pidPath: [pid],
				processName: appData.name,
				start: Date.now(),
			}
			games.push(fakeGame)
			FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [], added: [fakeGame], games: games})
			
			let fn = data => {
				let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.PLAY_ON_DESKTOP.value)
				console.log(`Quest progress: ${progress}/${secondsNeeded}`)
				
				if(progress >= secondsNeeded) {
					console.log("Quest completed!")
					
					const idx = games.indexOf(fakeGame)
					if(idx > -1) {
						games.splice(idx, 1)
						FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [fakeGame], added: [], games: []})
					}
					FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
				}
			}
			FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
			
			console.log(`Spoofed your game to ${applicationName}. Wait for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
		})
	} else if(taskName === "STREAM_ON_DESKTOP") {
		if(!isApp) {
			console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
		}
		
		let realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata
		ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
			id: applicationId,
			pid,
			sourceName: null
		})
		
		let fn = data => {
			let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.STREAM_ON_DESKTOP.value)
			console.log(`Quest progress: ${progress}/${secondsNeeded}`)
			
			if(progress >= secondsNeeded) {
				console.log("Quest completed!")
				
				ApplicationStreamingStore.getStreamerActiveStreamMetadata = realFunc
				FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
			}
		}
		FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
		
		console.log(`Spoofed your stream to ${applicationName}. Stream any window in vc for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
		console.log("Remember that you need at least 1 other person to be in the vc!")
	} else if(taskName === "PLAY_ACTIVITY") {
		const channelId = ChannelStore.getSortedPrivateChannels()[0]?.id ?? Object.values(GuildChannelStore.getAllGuilds()).find(x => x != null && x.VOCAL.length > 0).VOCAL[0].channel.id
		const streamKey = `call:${channelId}:1`
		
		let fn = async () => {
			console.log("Completing quest", applicationName, "-", quest.config.messages.questName)
			
			while(true) {
				const res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: false}})
				const progress = res.body.progress.PLAY_ACTIVITY.value
				console.log(`Quest progress: ${progress}/${secondsNeeded}`)
				
				await new Promise(resolve => setTimeout(resolve, 20 * 1000))
				
				if(progress >= secondsNeeded) {
					await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: true}})
					break
				}
			}
			
			console.log("Quest completed!")
		}
		fn()
	}
}
  1. Follow the printed instructions depending on what type of quest you have
    • If your quest says to "play" the game, you can just wait and do nothing
    • If your quest says to "stream" the game, join a vc with a friend or alt and stream any window
  2. Wait for 15 minutes
  3. 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.

FAQ

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 syntax error/unexpected token error

A: Make sure your browser isn't auto-translating this website before copying the script. Turn off any translator extensions and try again.

Q: I get the error Cannot read properties of undefined (reading 'nativeModules')

A: You're on a modded client which is a browser wrapper (i.e. Vesktop). Use an actual desktop app.

Q: I get a different error

A: Make sure you're copy/pasting the script correctly and that you've have done all the steps.

Q: Can you make the script auto accept the quest/reward?

A: No. Both of those actions may show a captcha, so automating them is not a good idea. Just do the two clicks yourself.


Side note: Please don't post your "fixed" or "improved" versions of the script in the comments. It creates unnecessary confusion, often doesn't fix anything, and sometimes puts other people's accounts at risk. I might redact/delete such comments without notice. Thank you for understanding.

@gitcashxo
Copy link

2XP COD Code: 17ME-YCZBN-4PN9

P-90 Pioneer Blue: DJ3GfdqT00KWRNVDYP

@RFS-ADRENO
Copy link

2XP COD: 1H61-GKNV8-NQEN

@Trubbel
Copy link

Trubbel commented Dec 17, 2024

Garena® Delta Force: P90 - Pioneer Blue
DJsn9RJ90001YPSTP9

@HIFun-cws
Copy link

Delta Force code DJsn9RJ900YN581W14

Garena® Delta Force: P90 - Pioneer Blue DJsn9RJ90001YPSTP9

@HIFun-cws
Copy link

Bobo the Picnic Bear code: D7UVW7P8J9J9

@mesalytic
Copy link

Bobo the Picnic Bear: JFY8P8X7QWCU

@AlienFromMars-itzme
Copy link

image helpp

same problem with rec room quest

@kenntcky
Copy link

love how people are sharing codes for games they don't play, to help the players that actually plays the game. Very cool. Also, here is TFD discord collection bundle code: 9WMPCFZCPS

@Trubbel
Copy link

Trubbel commented Jan 7, 2025

Off The Grid: Impact Junkie Set
DISC-11KC-YZ7Y-TRZG

V2.0 WUWA Quest Pack
11QS1ZA993VM

@7aix
Copy link

7aix commented Jan 7, 2025

Off The Grid: Impact Junkie Set
DISC-11PF-FPFN-HDHV

V2.0 WUWA Quest Pack
1EYYTQRYEU8X

@neelpanchal92
Copy link

Off The Grid: Impact Junkie Set DISC-11PF-FPFN-HDHV

V2.0 WUWA Quest Pack 1EYYTQRYEU8X

Can u give me another code plz

@RFS-ADRENO
Copy link

Off The Grid: Impact Junkie Set
DISC-12H3-UT76-WETF

V2.0 WUWA Quest Pack
8Q606O7Z3JGV

@Pearl8520
Copy link

Off The Grid: Impact Junkie Set
DISC-13ME-F9YW-U1YR

@Trubbel
Copy link

Trubbel commented Jan 8, 2025

Genshin Impact: V5.3 Quest Bundle
2ALPEU2UVW45

@mesalytic
Copy link

Genshin Impact - V5.3 Quest Bundle: 2B57XBLQQWXR
Wuthering Waves - V2.0 WUWA Quest Pack: FIB70B230YP0

@mesalytic
Copy link

Off The Grid - Impact Junkie Set: DISC-13YM-9DNE-E73V

@EtherialSagaz
Copy link

EtherialSagaz commented Jan 9, 2025

Press windows + r and put %AppData%/Discord, search settings.json an put this:
{B8E2351C-EF67-4841-868E-E8F59EBF120B}
Guys do this and press ctrl + shift + i in ur discord app and past the script, and it's done !

@EtherialSagaz
Copy link

Wuthering Waves - V2.0 WUWA Quest Pack: FVO5EZ07LSYC

@PRIME12602
Copy link

Off the Grid - DISC-146M-MX73-WVWC
Wuthering Waves V2.0 - H94MZHFDIXNO

@best35best
Copy link

best35best commented Jan 9, 2025

Wuthering Waves V2.0: HF53416RGZ8V
Off the Grid: DISC-13MV-D1YG-NK6W

@neelpanchal92
Copy link

Can someone give me another redeem code this trick is not working for me plz

@Tetroner9
Copy link

V2.0 WUWA Quest Pack: H2H8J25WYUWS
V5.3 Quest Bundle: 2T5NFETXY2AR
Impact Junkie Set: DISC-14D3-RMRD-7EK3

@Xtraneous69
Copy link

Need me a 2.0 Wuwa Quest Pack, only on mobile so I can't do it and also can't get any other form of help

@BlackD14
Copy link

Need me a 2.0 Wuwa Quest Pack, only on mobile so I can't do it and also can't get any other form of help

FBH7DBTN3ZFP

@Xtraneous69
Copy link

Need me a 2.0 Wuwa Quest Pack, only on mobile so I can't do it and also can't get any other form of help

FBH7DBTN3ZFP

No freaking way bro I just woke up, saw this, immediately tried to redeem and bro someone sniped it already (someone else redeemed it), goddamnit
Addendum: if anyone else see this please please ( need it, I'm not sure if Private message is a feature here but if you could that would help alot if you have a code, this like the LAST CHANCE cos from what I know its only a day left for this quest

@aamiaa
Copy link
Author

aamiaa commented Jan 12, 2025

Need me a 2.0 Wuwa Quest Pack, only on mobile so I can't do it and also can't get any other form of help

FBH7DBTN3ZFP

No freaking way bro I just woke up, saw this, immediately tried to redeem and bro someone sniped it already (someone else redeemed it), goddamnit Addendum: if anyone else see this please please ( need it, I'm not sure if Private message is a feature here but if you could that would help alot if you have a code, this like the LAST CHANCE cos from what I know its only a day left for this quest

What's your discord? I'll give you mine

@Xtraneous69
Copy link

Xtraneous69 commented Jan 12, 2025

Need me a 2.0 Wuwa Quest Pack, only on mobile so I can't do it and also can't get any other form of help

FBH7DBTN3ZFP

No freaking way bro I just woke up, saw this, immediately tried to redeem and bro someone sniped it already (someone else redeemed it), goddamnit Addendum: if anyone else see this please please ( need it, I'm not sure if Private message is a feature here but if you could that would help alot if you have a code, this like the LAST CHANCE cos from what I know its only a day left for this quest

What's your discord? I'll give you mine

Discord: s*******
Thanks so much man, real hero

@aamiaa
Copy link
Author

aamiaa commented Jan 12, 2025

Dmed you from aamia

@Spectyed
Copy link

I need me a code for junkie set, WUWA, or genshin my discord .hsps1

@toni963
Copy link

toni963 commented Jan 12, 2025

Genshin V5,3 Quest Bundle

7A56XF2DL475

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