Skip to content

Instantly share code, notes, and snippets.

@aamiaa
Last active May 28, 2024 16:20
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 = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getRunningGames).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 api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports;

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
	const secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
	
	if(quest.config.variants.includes(2)) {
		api.HTTP.get({url: `/applications/public?application_ids=${quest.config.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: quest.config.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 = data.userStatus.streamProgressSeconds
				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 ${quest.config.applicationName}. Wait for ${Math.ceil(quest.config.streamDurationRequirementMinutes - (quest.userStatus?.streamProgressSeconds ?? 0) / 60)} more minutes.`)
		})
	} else {
		let realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata
		ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
			id: quest.config.applicationId,
			pid,
			sourceName: null
		})
		
		let fn = data => {
			let progress = data.userStatus.streamProgressSeconds
			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 ${quest.config.applicationName}. Stream any window 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. 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.

@aamiaa
Copy link
Author

aamiaa commented May 24, 2024

Honestly guys, I tried this code and it didn't work several times. I keep getting "undefined" instead of the quest time. I found another GitHub page with another persons code and it worked for me. If you want to use it then here's the link: RussDev7/4744bd50dd65db27f9fd162e911fd936

But you know that's the exact same code? lol

True, but it's slightly different, since somehow that worked for me as well. You can take a look as to why that worked when this one didn't, especially for us folks. Then you can add that as an alternative code snippet/solution for those who face similar issues in the future

No it's literally 1:1 same code. If you look at revisions it's just a fork of this gist without any changes.

@sametaor
Copy link

Honestly guys, I tried this code and it didn't work several times. I keep getting "undefined" instead of the quest time. I found another GitHub page with another persons code and it worked for me. If you want to use it then here's the link: RussDev7/4744bd50dd65db27f9fd162e911fd936

But you know that's the exact same code? lol

True, but it's slightly different, since somehow that worked for me as well. You can take a look as to why that worked when this one didn't, especially for us folks. Then you can add that as an alternative code snippet/solution for those who face similar issues in the future

No it's literally 1:1 same code. If you look at revisions it's just a fork of this gist without any changes.

Ah I see it now. So if there's no issue, could you paste this as an alternative solution if current one doesn't work? As I said, might prove helpful in the future if people do the same blunders like accepting two quests at once or not being able to use this one in a proper way.

@aamiaa
Copy link
Author

aamiaa commented May 24, 2024

Honestly guys, I tried this code and it didn't work several times. I keep getting "undefined" instead of the quest time. I found another GitHub page with another persons code and it worked for me. If you want to use it then here's the link: RussDev7/4744bd50dd65db27f9fd162e911fd936

But you know that's the exact same code? lol

True, but it's slightly different, since somehow that worked for me as well. You can take a look as to why that worked when this one didn't, especially for us folks. Then you can add that as an alternative code snippet/solution for those who face similar issues in the future

No it's literally 1:1 same code. If you look at revisions it's just a fork of this gist without any changes.

Ah I see it now. So if there's no issue, could you paste this as an alternative solution if current one doesn't work? As I said, might prove helpful in the future if people do the same blunders like accepting two quests at once or not being able to use this one in a proper way.

There is no alternative solution, it's literally the same code 😭

@K33ko
Copy link

K33ko commented May 25, 2024

hey aamiaa the code does the code not work anymore? im pasting it in the console and i am seeing heartbeat messages but no progress, it also said "undefined" can you help? or is it patched

@aamiaa
Copy link
Author

aamiaa commented May 25, 2024

It should still work. The "undefined" doesn't matter.

@tismofied
Copy link

Thank you @aamiaa . Worked like a charm. gave star ⭐⭐⭐⭐⭐

@sametaor
Copy link

Honestly guys, I tried this code and it didn't work several times. I keep getting "undefined" instead of the quest time. I found another GitHub page with another persons code and it worked for me. If you want to use it then here's the link: RussDev7/4744bd50dd65db27f9fd162e911fd936

But you know that's the exact same code? lol

True, but it's slightly different, since somehow that worked for me as well. You can take a look as to why that worked when this one didn't, especially for us folks. Then you can add that as an alternative code snippet/solution for those who face similar issues in the future

No it's literally 1:1 same code. If you look at revisions it's just a fork of this gist without any changes.

Ah I see it now. So if there's no issue, could you paste this as an alternative solution if current one doesn't work? As I said, might prove helpful in the future if people do the same blunders like accepting two quests at once or not being able to use this one in a proper way.

There is no alternative solution, it's literally the same code 😭

My bad, really sorry for misunderstanding. And thanks a lot for the code, it did help me out on the other two quests after all!

@K33ko
Copy link

K33ko commented May 25, 2024

It should still work. The "undefined" doesn't matter.

oohh my bad i just realized something, my quest is not to stream any game, it says "play pubg battlegrounds for 15 minutes" just that. is there any other code or something to get me dont with this quest that requires me to play and not stream the game?

@courfazor
Copy link

courfazor commented May 25, 2024

It should still work. The "undefined" doesn't matter.

oohh my bad i just realized something, my quest is not to stream any game, it says "play pubg battlegrounds for 15 minutes" just that. is there any other code or something to get me dont with this quest that requires me to play and not stream the game?

You are actually on to something and we are all being idiots!

Maybe some people got the quest to stream the game and others to just play the game?
Here's what it says on the account where it doesn't work: "Play PUBG for 15 minutes"
Screenshot 2024-05-25 at 22 08 12

Also to all the 1:1 forks and people who said the fork worked out and not this exact same code: lol, I feel sorry for you @aamiaa
Beware of people changing it to malicious code later and people running that. I could see that happening... Better to not link anything external here. Remember the XZ backdoor had a ton of social engineering before they decided to act.

@courfazor
Copy link

courfazor commented May 25, 2024

This is how I got the PUBG quest: Rename any .exe file on Windows to TslGame.exe, run it and Discord will think you are playing PUBG and it will progress.

For example:

  1. Find any installer. For example anything in the Downloads folder. If you don't have any download for example 7Zip installer from 7-zip.org, or if you want to be funny use the Discord installer from discord.com
  2. Re-name the .exe installer to TslGame.exe
  3. Run it, you do not have to install anything just keep it running for 15 minutes

Play PUBG for 15 minutes Quest should unlock in 15 minutes.

@aamiaa
Copy link
Author

aamiaa commented May 25, 2024

You guys are right, I didn't notice the "play" vs "stream" variants.
From what I see, they introduced this on May 13th, and the script worked fine with that a day later, tho I wouldn't be surprised if this has broken since then.

For those who have the "play" variant, does the script work for you when you follow the instructions regardless?
If not, can you try the following and see if it works:

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getRunningGames).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 api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports;

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 {
	api.HTTP.get({url: `/applications/public?application_ids=${quest.config.applicationId}`}).then(res => {
		const appData = res.body[0]
		const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
		
		const pid = Math.floor(Math.random() * 30000) + 1000
		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: quest.config.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 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!")
				
				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 ${quest.config.applicationName}. Wait for ${Math.ceil(quest.config.streamDurationRequirementMinutes - (quest.userStatus?.streamProgressSeconds ?? 0) / 60)} more minutes.`)
	})
}

@itskenili
Copy link

PUBG: U01743-KGZ0-2LLV-FLUW8
Honkai: YAKTR9J4FC4X

@K33ko
Copy link

K33ko commented May 26, 2024

just tried that new script and it worked, didn't need to be in a vc nor needed any other alt account. just pasted that in the console and waited 15 minutes thank you aamiaa! (how did we not notice the play quest before lmfao)

@aamiaa
Copy link
Author

aamiaa commented May 26, 2024

Okay awesome, thanks for testing it!
I will update the main gist tomorrow to make it automatically choose which version of the code to run.

@barraIhsan
Copy link

barraIhsan commented May 26, 2024

You guys are right, I didn't notice the "play" vs "stream" variants. From what I see, they introduced this on May 13th, and the script worked fine with that a day later, tho I wouldn't be surprised if this has broken since then.

For those who have the "play" variant, does the script work for you when you follow the instructions regardless? If not, can you try the following and see if it works:

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getRunningGames).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 api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports;

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 {
	api.HTTP.get({url: `/applications/public?application_ids=${quest.config.applicationId}`}).then(res => {
		const appData = res.body[0]
		const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
		
		const pid = Math.floor(Math.random() * 30000) + 1000
		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: quest.config.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 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!")
				
				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 ${quest.config.applicationName}. Wait for ${Math.ceil(quest.config.streamDurationRequirementMinutes - (quest.userStatus?.streamProgressSeconds ?? 0) / 60)} more minutes.`)
	})
}

ohhhh... that's why the pubg didnt work (I was confused why it didn'r print out "Quest Progress"), it's PLAY not STREAM, thanks! it's working now

@sametaor
Copy link

sametaor commented May 26, 2024

You guys are right, I didn't notice the "play" vs "stream" variants. From what I see, they introduced this on May 13th, and the script worked fine with that a day later, tho I wouldn't be surprised if this has broken since then.

For those who have the "play" variant, does the script work for you when you follow the instructions regardless? If not, can you try the following and see if it works:

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getRunningGames).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 api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports;

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 {
	api.HTTP.get({url: `/applications/public?application_ids=${quest.config.applicationId}`}).then(res => {
		const appData = res.body[0]
		const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
		
		const pid = Math.floor(Math.random() * 30000) + 1000
		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: quest.config.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 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!")
				
				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 ${quest.config.applicationName}. Wait for ${Math.ceil(quest.config.streamDurationRequirementMinutes - (quest.userStatus?.streamProgressSeconds ?? 0) / 60)} more minutes.`)
	})
}

Yep, it works!
PUBG: U01743-KILK-F3HI-FG5RQ

@barraIhsan
Copy link

PUBG: U01743-KKGB-BN2H-VUO2X

@kacygd
Copy link

kacygd commented May 26, 2024

PUBG U01743-KQYI-LDRY-1MRF7

@K33ko
Copy link

K33ko commented May 26, 2024

Okay awesome, thanks for testing it! I will update the main gist tomorrow to make it automatically choose which version of the code to run.

no problem! thanks for your work, dropped a follow.

@Rayyan2650
Copy link

it doesn't work in browser
image
is it patched now? (my quest was the pubg one play it for 15minutes)

@Azqupai
Copy link

Azqupai commented May 26, 2024

PUBG: U01743-KUQH-RNR9-XKQDV

@Rayyan2650
Copy link

it doesn't work in browser
image
is it patched now? (my quest was the pubg one play it for 15minutes)

@sametaor
Copy link

it doesn't work in browser image is it patched now? (my quest was the pubg one play it for 15minutes)

Browser won't work for this anyways, as the description says, you're better off using discord ptb or enabling the inspect mode in discord app on desktop

@K33ko
Copy link

K33ko commented May 26, 2024

it doesn't work in browser image is it patched now? (my quest was the pubg one play it for 15minutes)

it doesnt work in browser you have to do it in the discord app but to be able to open console in the discord app you have to enable that first in the settings.json file of discord (u can easily find a quick tutorial on that)

@BSNIKYT
Copy link

BSNIKYT commented May 26, 2024

I set the resolution, opened the console and pasted the code. But I don't receive 0/900 data in response. What's the matter?
image

@Tifanadputra
Copy link

Same problem, I just tried it and the quest process didn't increase the percent

I set the resolution, opened the console and pasted the code. But I don't receive 0/900 data in response. What's the matter? image
Same problem, I just tried it and the quest process didn't increase the percent

@Hacktiv8or
Copy link

Hacktiv8or commented May 28, 2024

I set the resolution, opened the console and pasted the code. But I don't receive 0/900 data in response. What's the matter? image

Same Problem with me too... it just gives this error
Screenshot 2024-05-28 095754

@Tanishq-rwt9
Copy link

same

@Aviviviviveee
Copy link

mmm, ive got the same problem as the people above me. the progress bar just doesnt move.

@quincynyan
Copy link

U01743-OJM4-AC41-KHI45
PUBG

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