Skip to content

Instantly share code, notes, and snippets.

@aamiaa
Last active June 26, 2024 08:44
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 no longer works in browser!

This no longer works if you're alone in vc! Somebody else has to join you!

Warning

There are now two quest types ("stream" and "play")! Pay attention to the instructions!

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
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let ApplicationStreamingStore, RunningGameStore, QuestsStore, ExperimentStore, FluxDispatcher, api
if(window.GLOBAL_ENV.SENTRY_TAGS.buildId === "366c746173a6ca0a801e9f4a4d7b6745e6de45d4") {
	ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
	RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getRunningGames).exports.default;
	QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
	ExperimentStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getGuildExperiments).exports.default;
	FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.default?.flushWaitQueue).exports.default;
	api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
} else {
	ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getStreamerActiveStreamMetadata).exports.Z;
	RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getRunningGames).exports.ZP;
	QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getQuest).exports.Z;
	ExperimentStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getGuildExperiments).exports.Z;
	FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.flushWaitQueue).exports.Z;
	api = Object.values(wpRequire.c).find(x => x?.exports?.tn?.get).exports.tn;
}

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 {
	const pid = Math.floor(Math.random() * 30000) + 1000
	
	let applicationId, applicationName, secondsNeeded, secondsDone, canPlay
	if(quest.config.configVersion === 1) {
		applicationId = quest.config.applicationId
		applicationName = quest.config.applicationName
		secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
		secondsDone = quest.userStatus?.streamProgressSeconds ?? 0
		canPlay = quest.config.variants.includes(2)
	} else if(quest.config.configVersion === 2) {
		applicationId = quest.config.application.id
		applicationName = quest.config.application.name
		canPlay = ExperimentStore.getUserExperimentBucket("2024-04_quest_playtime_task") > 0 && quest.config.taskConfig.tasks["PLAY_ON_DESKTOP"]
		const taskName = canPlay ? "PLAY_ON_DESKTOP" : "STREAM_ON_DESKTOP"
		secondsNeeded = quest.config.taskConfig.tasks[taskName].target
		secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0
	}

	if(canPlay) {
		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 {
		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!")
	}
}
  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 different error

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

@MetricsLite
Copy link

MetricsLite commented Jun 14, 2024

EB5V-TWPBH-LMFE
EBF9-NPSR1-SZ1Q

@d3v7
Copy link

d3v7 commented Jun 14, 2024

@aamiaa
Quest progress: 0/900 is not updating
this works

let progress = data.userStatus.progress.STREAM_ON_DESKTOP.value
let percent_completed = (progress / secondsNeeded) * 100
console.log(`Quest progress: ${progress}/${secondsNeeded}`)
console.log(`Quest progress: ${percent_completed.toFixed(2)}%`)

My unused code: ECP6-702H2-B157

@dharsoumyadip
Copy link

Much thanks for the badge aamiaa.

EFP8-TJ7G8-KWQX

@hussein33r
Copy link

hi is that work in mw3?

@gres-roman
Copy link

Не працює

@brunenberg
Copy link

I don't need this: ERRS-WBC9C-10J5

@Mertyyyyy
Copy link

Uncaught SyntaxError: Unexpected identifier 'olsun'

bu hatayı veriyor nasıl düzelebilirim

@m-faizananwar
Copy link

where is the script?

@d3v7
Copy link

d3v7 commented Jun 15, 2024

where is the script?

here
gist

@m-faizananwar
Copy link

As of this moment (14 June, 2024), I know how to do it successfully.

You CANNOT do it: in a browser, without a friend on the VC (or more).

What you need to do is download DiscordPTB if you don't have it already (helps you with the whole Console opening thing), join a vc and simply share your screen AFTER you have copy pasted the code to the Console of your DisordPTB.

My MW3 code I received (unused): E7JV-EJ2QK-WXW2

Enjoy!

can you tell me your discord username for dm?

@synnno
Copy link

synnno commented Jun 16, 2024

@aamiaa https://cdn.discordapp.com/attachments/1195061611711438848/1251815299658022912/message.txt?ex=666ff359&is=666ea1d9&hm=ef27b020597902e8ffa56c4157c5d8f05c3d78e5633eed0eb9839e966f9b5481&
an easier way to inject code into discord app is trough better discord plugins i made this one and it works perfectly just create quest.plugin.js in plugins folder

@NinjaRito
Copy link

code for MWIII: EYZ0-KLM3B-9FVT

@scopy11
Copy link

scopy11 commented Jun 16, 2024

Here's my COD code: CXCM-RGXDQ-RYP8

Enjoy!

THANK YOU SO MUCH OMG

@lvl-d
Copy link

lvl-d commented Jun 16, 2024

F9WR-3P9FQ-9N6M

@TheAustrianHausi
Copy link

And for what is the COD Code?

@mi0lt
Copy link

mi0lt commented Jun 16, 2024

it's not working 🥹

@miiplaza
Copy link

heres my unused code: FJJG-H5K45-7X1V

@TheAustrianHausi
Copy link

Code?

@luc122c
Copy link

luc122c commented Jun 17, 2024

FJJG-H5K45-7X1V

Redeemed this. Thank you @miiplaza <3

@mayu-z
Copy link

mayu-z commented Jun 17, 2024

i need a code as well

@sneazy-ibo
Copy link

Is there someone else getting this error?

image

@ZFHailey
Copy link

Is there someone else getting this error?

image

I have this issue too.

@BlackCatOnline
Copy link

some cod blueprint: FSPP-17CXG-228J

Script works perfectly, thanks!

@AxosFalox
Copy link

some cod blueprint: FSPP-17CXG-228J

Script works perfectly, thanks!

can you help me set it up?? its not working for me and i really need your help.

@ZFHailey
Copy link

It still gives me the error typeerror as above.. Is it just me?

@mayu-z
Copy link

mayu-z commented Jun 17, 2024

gimme a code

@AxosFalox
Copy link

gimme a code

how to even use a code?

@AxosFalox
Copy link

It still gives me the error typeerror as above.. Is it just me?

its me as well.

@AxosFalox
Copy link

Is there someone else getting this error?

image

can you let me know if you got it working please?? i got the same issue.

@aamiaa
Copy link
Author

aamiaa commented Jun 17, 2024

can you let me know if you got it working please?? i got the same issue.

You're on canary/ptb. Use stable.

@aamiaa
Copy link
Author

aamiaa commented Jun 17, 2024

Okay I just realized how dumb that sounds after I tell people to use ptb in the gist.
If you can't use stable then wait a bit. Discord pushed major code changes today and I don't want to update the gist until they reach stable.

@mayu-z
Copy link

mayu-z commented Jun 17, 2024

gimme a code

how to even use a code?

do you play mw3? if yes then go to callofduty.com/redeem and then paste that code with your uid and that's it you'll get the skin

@AxosFalox
Copy link

can you let me know if you got it working please?? i got the same issue.

You're on canary/ptb. Use stable.

can you let me know if you got it working please?? i got the same issue.

You're on canary/ptb. Use stable.

yea im on ptb, wait whats stable? Sorry im a bit slow but could you explain it to me, please??

@aamiaa
Copy link
Author

aamiaa commented Jun 17, 2024

yea im on ptb, wait whats stable? Sorry im a bit slow but could you explain it to me, please??

The normal version of discord. Not ptb, not canary.

@AxosFalox
Copy link

AxosFalox commented Jun 17, 2024

yea im on ptb, wait whats stable? Sorry im a bit slow but could you explain it to me, please??

The normal version of discord. Not ptb, not canary.

ah i see but the ctrl + shift + I doesnt work for me, so i just have to wait till you update the gist till they reach stable am i correct? Because the COD WIII event will end June 19 2024

@aamiaa
Copy link
Author

aamiaa commented Jun 17, 2024

Use this one for now, I think it should work:

[removed to avoid confusing people]

@AxosFalox
Copy link

AxosFalox commented Jun 17, 2024

Use this one for now, I think it should work:

[removed to avoid confusing people]

on stable or the other ones?

@ZFHailey
Copy link

ZFHailey commented Jun 17, 2024

Use this one for now, I think it should work:

Click to expand

This works on ptb just to confirm it

@AxosFalox
Copy link

Use this one for now, I think it should work:
Click to expand

This works on ptb just to confirm it

huh, it didnt work for me idk why, let me try re installing it

@AxosFalox
Copy link

image
no it still didnt work.

@AxosFalox
Copy link

Use this one for now, I think it should work:
Click to expand

This works on ptb just to confirm it

can you please help me with it?

@aamiaa
Copy link
Author

aamiaa commented Jun 17, 2024

Right i missed a spot
This one should work now:
[removed to avoid confusing people]

@AxosFalox
Copy link

AxosFalox commented Jun 17, 2024

Right i missed a spot This one should work now:

[removed to avoid confusing people]

OH THANK YOU SO MUCH IT WORKED FINALLY

@ZFHailey
Copy link

Heres a code for anyone : FTW1-H0DNF-1YZY

@aamiaa
Copy link
Author

aamiaa commented Jun 18, 2024

I've updated the main gist with a workaround that handles both stable and canary/ptb, so it should be fine to use that one for now
(more clutter in the code yay!)

@AxosFalox
Copy link

gimme a code

how to even use a code?

do you play mw3? if yes then go to callofduty.com/redeem and then paste that code with your uid and that's it you'll get the skin

here is the code if you want FV1W-EP5EM-0MZ3

@sneazy-ibo
Copy link

I've updated the main gist with a workaround that handles both stable and canary/ptb, so it should be fine to use that one for now (more clutter in the code yay!)

Your code works now but the logs are broken, it just returns an undefined error instead of logging the time. Still thx for the update :)

@terrariapro147
Copy link

FW5Z-QZ25L-18CG, cod code

@TomerGamerTV
Copy link

TomerGamerTV commented Jun 18, 2024

Right i missed a spot This one should work now:

[removed to avoid confusing people]

Got this error
image

@aamiaa
Copy link
Author

aamiaa commented Jun 18, 2024

Run the script in the main gist, not random edits I post for specific people...

@aamiaa
Copy link
Author

aamiaa commented Jun 18, 2024

Your code works now but the logs are broken, it just returns an undefined error instead of logging the time. Still thx for the update :)

Should be fixed now

@Phantom-Noir
Copy link

Screenshot 2024-06-17 202550
Still receiving Type error

@GoopGhostt
Copy link

Screenshot 2024-06-17 202550 Still receiving Type error

I'm getting this as well

@ayaojee
Copy link

ayaojee commented Jun 18, 2024

Screenshot 2024-06-18 084639
how can i fix this please

@sirius-sama
Copy link

Thanks, it worked. Guys follow the instructions properly and it'll work fs.
image

@ayaojee
Copy link

ayaojee commented Jun 18, 2024

@sirius-sama
pls dm me in discord and tell me what i do
my name is : ayaojee

@sirius-sama
Copy link

@sirius-sama pls dm me in discord and tell me what i do my name is : ayaojee

check

@txmu1
Copy link

txmu1 commented Jun 18, 2024

Your code works now but the logs are broken, it just returns an undefined error instead of logging the time. Still thx for the update :)

Should be fixed now

image how can i fix this ?

discord ptb

@Jxnasus
Copy link

Jxnasus commented Jun 18, 2024

Another CoD Code: G1S8-J9633-BPBC
for someone to use, I am not playing that game

@MisterGambler
Copy link

Guys it doesnt work can someone send me the full code maybe i copied it wrong

@Trolleye-ux
Copy link

Guys,i didnt wanted to lie,but none of the codes work....But i think its not suprising after all wtf

@devii123i
Copy link

Im putting the script in and it is doing nothing?? someone help please
image

@devii123i
Copy link

nevermind it is working

@Trolleye-ux
Copy link

where did the script go?

@d3v7
Copy link

d3v7 commented Jun 18, 2024

where did the script go?
Click to expand
IMG_2034

@Suspectxyzz
Copy link

G5E1-N2N40-ZVQD

@epiwww
Copy link

epiwww commented Jun 18, 2024

hi ! dont work for me :(
image_2024-06-18_203013642

@Smilqo
Copy link

Smilqo commented Jun 20, 2024

image
how to fix

@aamiaa
Copy link
Author

aamiaa commented Jun 20, 2024

image
how to fix

Use the desktop app

@quincynyan
Copy link

image

@AnonymousUserInthisGithub

call of duty: 10B9-QZ5BG-1XJK

@Radiant-F
Copy link

can you guys shut the fuck up

@GuidingLight20
Copy link

the new code doesnt work :(

@sambecause
Copy link

I've updated the main gist with a workaround that handles both stable and canary/ptb, so it should be fine to use that one for now (more clutter in the code yay!)

I don't see ny quest in my gift inventory

@mi0lt
Copy link

mi0lt commented Jun 21, 2024

can someone send me a code i try this for like 13 times and it didn't work for me 🥲 if anyone have a code can you please give it to me my discord is xi0lt

@Sub-Archeo
Copy link

how about for minecraft?

@Xoncia
Copy link

Xoncia commented Jun 21, 2024

The script works perfectly fine, I'm not sure what everyone here is complaining about.
PS; on a side note @aamiaa (your bio is 120% relatable)

@Trolleye-ux
Copy link

Trolleye-ux commented Jun 21, 2024

or can someone send me a code?

name : wareye_yt

@rorixpatrick
Copy link

Minecraft Trial Mask : 2MY3J-3XHG7-YK4X9-2MKDM-3V3JZ

@Trolleye-ux
Copy link

not vaild xddddddd

@Trolleye-ux
Copy link

Trolleye-ux commented Jun 21, 2024

if anyone has a vaild code,text me on dc

@Konaimav2
Copy link

LETSGOOO MINECRAFT TIME

@truelockmc
Copy link

Screenshot 2024-06-18 084639 how can i fix this please

Use the desktop app, or just watch this tutorial by ntts https://www.youtube.com/watch?v=MV33-XB0gss

@clearnet
Copy link

MINECRAFT CODE: 23Y96-FVFPP-WY76V-PW62R-X7DPZ

@truelockmc
Copy link

Call of Duty Blueprint Code:
ER9R-DSLGC-JREC
I dont play it so you can have it :)

@NakkOfLegend
Copy link

MC:
2YPG6-MQCYQ-39D43-3MM3P-FX7DZ

@NakkOfLegend
Copy link

CALL OF DUTY
FWWV-8M7QN-481E

@bigmac2010
Copy link

bigmac2010 commented Jun 21, 2024

ngl this actually works ! maybe some can't figure it out so i'm here to help u , so the 1st thing is this doesnt work on browser so go through the discord desktop application and install the ptb client version to use the console tab using ctrl+shift+i and make sure someone is with u in vc there is no special thing u need a friend it could be a bot also like i did with lofi-radio and if u cant paste the command by aamia then type allow pasting to enter the command and wait for atleast 15 - 20 mins and u r done. And lastly don't be a badge goblin just to show off ur badges to ur friends cuz u r risking ur whole computer just for a simple reward and a fricking badge.

@InfoBlock
Copy link

if anyone has a vaild code,text me on dc

Bro... just do this trick yourself and you get a code!

@cxb190007
Copy link

cxb190007 commented Jun 22, 2024

Minecraft Bedrock Trial Mask
3FMW7-KDCCT-3C79M-HCVW9-M2DCZ
3FW9K-6DF2Q-3C664-WFKC3-TDT4Z

@bakaxiaofang
Copy link

Minecraft Trial Mask:3MFYF-YCP46-YWCJ4-F3363-6VD4Z

@NIKITA12340-sudo
Copy link

Minecraft Trial Mask:3Q4D6-TQTRX-39H4Y-GWVMC-P9XCZ

@felixcplus
Copy link

If anyone needs it:
Minecraft Trial Mask: 3QXFV-JWRC4-7VDGP-QGRYG-KYMMZ

@MatuTheDragonCat
Copy link

HOW DO I DO THIS ON THE DESKTOP APP

@LuizWT
Copy link

LuizWT commented Jun 23, 2024

HOW DO I DO THIS ON THE DESKTOP APP

U need to Ctrl + Shift + I

@asyncedd
Copy link

im on vesktop. how do i do this?

@mahin12-ngl
Copy link

image
How do i fix this up??

@mahin12-ngl
Copy link

mahin12-ngl commented Jun 23, 2024

ngl this actually works ! maybe some can't figure it out so i'm here to help u , so the 1st thing is this doesnt work on browser so go through the discord desktop application and install the ptb client version to use the console tab using ctrl+shift+i and make sure someone is with u in vc there is no special thing u need a friend it could be a bot also like i did with lofi-radio and if u cant paste the command by aamia then type allow pasting to enter the command and wait for atleast 15 - 20 mins and u r done. And lastly don't be a badge goblin just to show off ur badges to ur friends cuz u r risking ur whole computer just for a simple reward and a fricking badge.

I have Minecraft and i'm streaming it
no risk at all!!

@Dylanvanschouwen
Copy link

Skill issue honestly. just figure it out it aint that hard.

@ZatrexReal
Copy link

ZatrexReal commented Jun 24, 2024

if you have minecraft trial mask code please dm me in discord: zatrex_123

@Trolleye-ux
Copy link

for me too please : wareye_yt

@BarievArtem
Copy link

Minecraft Trial Mask : 4Y22Q-RDYRP-XCRXV-3K76Y-QDQ7Z

@Mohammedsssshgdhfaf
Copy link

no longer works in browser??, then how im gonna do it?

@ZatrexReal
Copy link

no longer works in browser??, then how im gonna do it?

Download the app.for windows

@ZatrexReal
Copy link

Minecraft Trial Mask : 4Y22Q-RDYRP-XCRXV-3K76Y-QDQ7Z

Not working

@An0nX
Copy link

An0nX commented Jun 25, 2024

649FR-97GQG-PKDY4-F32CF-Y7KWZ

@aix05
Copy link

aix05 commented Jun 25, 2024

Minecraft Trial Mask: 67HC3-G4P92-R3MDT-RGJJQ-G9T3Z

@diziu
Copy link

diziu commented Jun 25, 2024

or can someone send me a code?

name : wareye_yt

Minecraft Trial Mask: 69KQR-6TFGG-4C962-T7TFY-KHR6Z

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