Skip to content

Instantly share code, notes, and snippets.

@aamiaa
Last active March 31, 2025 17:12
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 Discover -> Quests
  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?.__proto__?.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?.__proto__?.getQuest).exports.Z;
let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.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?.__proto__?.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 = typeof DiscordNative !== "undefined"
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 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(),
			}
			const realGames = RunningGameStore.getRunningGames()
			const fakeGames = [fakeGame]
			const realGetRunningGames = RunningGameStore.getRunningGames
			const realGetGameForPID = RunningGameStore.getGameForPID
			RunningGameStore.getRunningGames = () => fakeGames
			RunningGameStore.getGameForPID = (pid) => fakeGames.find(x => x.pid === pid)
			FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: realGames, added: [fakeGame], games: fakeGames})
			
			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!")
					
					RunningGameStore.getRunningGames = realGetRunningGames
					RunningGameStore.getGameForPID = realGetGameForPID
					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 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.

Q: Can you upload the standalone script to a repo and make this gist's code a one line fetch()?

A: No. Doing that would put you at risk because I (or someone in my account) could change the underlying code to be malicious at any time, then forcepush it away later, and you'd never know.


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.

@TrueShadow01
Copy link

Roblox Cactrot Code A16DII3A

@aamiaa
Copy link
Author

aamiaa commented Mar 14, 2025

what is this proto kindly do tell i also have your old version in that version you directly used

QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getQuest).exports.Z;
// give error when doing QuestsStore.quests.values()

but now

let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.getQuest).exports.Z;
//now QuestsStore.quests.values() dont give error

It's to prevent the find() from grabbing the intl proxy object which returns a non-null value for any field name

@mesalytic
Copy link

[Seekers of Skyveil] Grassland Strix Skin: 7Bh7H-jEfpu
[Roblox] Cactrot: A1ADS7RV

@Kong-coder
Copy link

@aamiaa, you should do a raw on a commit, so that people know the code and don't change it. if people don't trust you, they can always take the script manually.

I had fun using your code and making gui :)

https://gist.github.com/user-attachments/assets/afefffe1-249d-4f60-b126-2faa77b3f2a2 image

i need code

@zee-dex3
Copy link

couldnt find a single code from the game i play in these comments

@kakashiix
Copy link

Roblox Cactrot code : A1N7G8A5

@omegion3
Copy link

Roblox Cactrot code: A1TIM65B

@r3eem
Copy link

r3eem commented Mar 15, 2025

why is the quests tab empty in browsers? completely empty i cant see any quest

@thepro-3418
Copy link

Quests tab is empty for newbies in discord web. Use the discord PTB with this exploit, it'll work.

why is the quests tab empty in browsers? completely empty i cant see any quest

@thepro-3418
Copy link

The people who do quests since quest tab's early days can use it in the Web version.

@blsps
Copy link

blsps commented Mar 17, 2025

Roblox Cactrot code:
A2AILBAP

@Trubbel
Copy link

Trubbel commented Mar 19, 2025

Overwatch 2: Frozen Seer Lifeweaver
5GVC-S6LF-4JHMF-MBKK-VSCQ

Note: Codes must be redeemed on Battle.net specifically, but will appear for any platform where that user has a license.

@thepro-3418
Copy link

Overwatch 2: Frozen Seer Lifeweaver
8LLC-GQGN-CRHRV-BDTH-SJ8J

Note: Codes must be redeemed on Battle.net specifically, but will appear for any platform where that user has a license

@GOZEYY
Copy link

GOZEYY commented Mar 20, 2025

Overwatch 2: Frozen Seer Lifeweaver
DH5X-SWLF-846J6-38X9-G3DR

Note: Codes must be redeemed on Battle.net specifically, but will appear for any platform where that user has a license

@U65535F
Copy link

U65535F commented Mar 21, 2025

Overwatch 2: Frozen Seer Lifeweaver
HSR9-N4XV-D8M9J-5WJF-RD9N

Note: Codes must be redeemed on Battle.net specifically, but will appear for any platform where that user has a license.

@thepro-3418
Copy link

Walmart Skyward Minecraft Marty-the-Hippo Quest: 10d9ewRIm7dBbVVlWYgctr

@Addamossama
Copy link

is there anyone who have overwatch coins code to spare pls guys

@thepro-3418
Copy link

is there anyone who have overwatch coins code to spare pls guys

You can scroll and find the codes. There are many.

@mesalytic
Copy link

[Walmart Skyward] Marty the Hippo Pet: 142a0wD86qoHLJspCvqzoM

@Addamossama
Copy link

is there anyone who have overwatch coins code to spare pls guys

You can scroll and find the codes. There are many.

where i can't find

@Addamossama
Copy link

there are loot boxes only

@7E57
Copy link

7E57 commented Mar 27, 2025

Visit microsoft.com/redeem by April 15, 2025 11:59 PM PST.
Payment method required. Subscription continues automatically unless cancelled.
This reward is not available in Argentina, China, Russia, and Turkey.

Code: 246W4-HJWY4-VC6CY-FV9KH-99HXZ

@thepacez
Copy link

Overwatch 2
Frozen Seer Lifeweaver
Use on battle.net desktop app
H364-DTJR-JD5G9-DWM8-6MFM

@thepacez
Copy link

Redeem the code below by opening Roblox Join The Hunt: Mega Edition experience (https://www.roblox.com/games/124180448122765/ The-Hunt-Mega -Edition)
Once in it, click 'Redeem Code' on the upper left Corner
Enter the code
A1SIG1VF

@thepacez
Copy link

Visit microsoft.com/redeem by April 15, 2025 11:59 PM PST.
Payment method required. Subscription continues automatically unless cancelled.
This reward is not available in Argentina, China, Russia, and Turkey.

Code: 2KRJW-96CRG-6G7V2-YCMF2-X92WZ

@MMMWMMWMWWWWWMWMWMMMMWWWMWWMMMMMWWMMMMW

xbox pc game pass trial code

3DJPX-D3Y7R-MWG7F-VYPQQ-CVVRZ
go nuts

@Wumpu7
Copy link

Wumpu7 commented Mar 29, 2025

marty the hippo - 1689a4wBQG5AGkDynyOzHs

@thepro-3418
Copy link

Visit microsoft.com/redeem by April 15, 2025 11:59 PM PST.
Payment method required. Subscription continues automatically unless cancelled.
This reward is not available in Argentina, China, Russia, and Turkey.

Code: 49JVD-HDG9K-G4FF6-V2GH7-C433Z

@Addamossama
Copy link

any life weaver skins?

@xxypher
Copy link

xxypher commented Mar 31, 2025 via email

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