notamitgamer

It's my profile man, there is ...
Log | Files | Refs | README

discord (7769B)


      1 {
      2   delete window.$;
      3   let wpRequire = webpackChunkdiscord_app.push([[Symbol()], {}, r => r]);
      4   webpackChunkdiscord_app.pop();
      5   
      6   let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getStreamerActiveStreamMetadata).exports.A;
      7   let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.Ay?.getRunningGames).exports.Ay;
      8   let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getQuest).exports.A;
      9   let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getAllThreadsForParent).exports.A;
     10   let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Ay?.getSFWDefaultChannel).exports.Ay;
     11   let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.h?.__proto__?.flushWaitQueue).exports.h;
     12   let api = Object.values(wpRequire.c).find(x => x?.exports?.Bo?.get).exports.Bo;
     13   
     14   const supportedTasks = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY", "WATCH_VIDEO_ON_MOBILE"]
     15   let quests = [...QuestsStore.quests.values()].filter(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now() && supportedTasks.find(y => Object.keys((x.config.taskConfig ?? x.config.taskConfigV2).tasks).includes(y)))
     16   let isApp = typeof DiscordNative !== "undefined"
     17   if(quests.length === 0) {
     18   	console.log("You don't have any uncompleted quests!")
     19   } else {
     20   	let doJob = function() {
     21   		const quest = quests.pop()
     22   		if(!quest) return
     23   
     24   		const pid = Math.floor(Math.random() * 30000) + 1000
     25   		
     26   		const applicationId = quest.config.application.id
     27   		const applicationName = quest.config.application.name
     28   		const questName = quest.config.messages.questName
     29   		const taskConfig = quest.config.taskConfig ?? quest.config.taskConfigV2
     30   		const taskName = supportedTasks.find(x => taskConfig.tasks[x] != null)
     31   		const secondsNeeded = taskConfig.tasks[taskName].target
     32   		let secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0
     33   
     34   		if(taskName === "WATCH_VIDEO" || taskName === "WATCH_VIDEO_ON_MOBILE") {
     35   			const speed = 7
     36   			const enrolledAt = new Date(quest.userStatus.enrolledAt).getTime()
     37   			let completed = false
     38   			let fn = async () => {			
     39   				while(true) {
     40   					const remaining = Math.min(speed, secondsNeeded - secondsDone)
     41   					await new Promise(resolve => setTimeout(resolve, remaining * 1000))
     42   
     43   					const timestamp = secondsDone + speed
     44   					const res = await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, timestamp + Math.random())}})
     45   					completed = res.body.completed_at != null
     46   					secondsDone = Math.min(secondsNeeded, timestamp)
     47   
     48   					if(timestamp >= secondsNeeded) {
     49   						break
     50   					}
     51   				}
     52   				if(!completed) {
     53   					await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: secondsNeeded}})
     54   				}
     55   				console.log("Quest completed!")
     56   				doJob()
     57   			}
     58   			fn()
     59   			console.log(`Spoofing video for ${questName}.`)
     60   		} else if(taskName === "PLAY_ON_DESKTOP") {
     61   			if(!isApp) {
     62   				console.log("This no longer works in browser for non-video quests. Use the discord desktop app to complete the", questName, "quest!")
     63   			} else {
     64   				api.get({url: `/applications/public?application_ids=${applicationId}`}).then(res => {
     65   					const appData = res.body[0]
     66   					const exeName = appData.executables?.find(x => x.os === "win32")?.name?.replace(">","") ?? appData.name.replace(/[\/\\:*?"<>|]/g, "")
     67   					
     68   					const fakeGame = {
     69   						cmdLine: `C:\\Program Files\\${appData.name}\\${exeName}`,
     70   						exeName,
     71   						exePath: `c:/program files/${appData.name.toLowerCase()}/${exeName}`,
     72   						hidden: false,
     73   						isLauncher: false,
     74   						id: applicationId,
     75   						name: appData.name,
     76   						pid: pid,
     77   						pidPath: [pid],
     78   						processName: appData.name,
     79   						start: Date.now(),
     80   					}
     81   					const realGames = RunningGameStore.getRunningGames()
     82   					const fakeGames = [fakeGame]
     83   					const realGetRunningGames = RunningGameStore.getRunningGames
     84   					const realGetGameForPID = RunningGameStore.getGameForPID
     85   					RunningGameStore.getRunningGames = () => fakeGames
     86   					RunningGameStore.getGameForPID = (pid) => fakeGames.find(x => x.pid === pid)
     87   					FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: realGames, added: [fakeGame], games: fakeGames})
     88   					
     89   					let fn = data => {
     90   						let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.PLAY_ON_DESKTOP.value)
     91   						console.log(`Quest progress: ${progress}/${secondsNeeded}`)
     92   						
     93   						if(progress >= secondsNeeded) {
     94   							console.log("Quest completed!")
     95   							
     96   							RunningGameStore.getRunningGames = realGetRunningGames
     97   							RunningGameStore.getGameForPID = realGetGameForPID
     98   							FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [fakeGame], added: [], games: []})
     99   							FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
    100   							
    101   							doJob()
    102   						}
    103   					}
    104   					FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
    105   					
    106   					console.log(`Spoofed your game to ${applicationName}. Wait for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
    107   				})
    108   			}
    109   		} else if(taskName === "STREAM_ON_DESKTOP") {
    110   			if(!isApp) {
    111   				console.log("This no longer works in browser for non-video quests. Use the discord desktop app to complete the", questName, "quest!")
    112   			} else {
    113   				let realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata
    114   				ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
    115   					id: applicationId,
    116   					pid,
    117   					sourceName: null
    118   				})
    119   				
    120   				let fn = data => {
    121   					let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.STREAM_ON_DESKTOP.value)
    122   					console.log(`Quest progress: ${progress}/${secondsNeeded}`)
    123   					
    124   					if(progress >= secondsNeeded) {
    125   						console.log("Quest completed!")
    126   						
    127   						ApplicationStreamingStore.getStreamerActiveStreamMetadata = realFunc
    128   						FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
    129   						
    130   						doJob()
    131   					}
    132   				}
    133   				FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
    134   				
    135   				console.log(`Spoofed your stream to ${applicationName}. Stream any window in vc for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
    136   				console.log("Remember that you need at least 1 other person to be in the vc!")
    137   			}
    138   		} else if(taskName === "PLAY_ACTIVITY") {
    139   			const channelId = ChannelStore.getSortedPrivateChannels()[0]?.id ?? Object.values(GuildChannelStore.getAllGuilds()).find(x => x != null && x.VOCAL.length > 0).VOCAL[0].channel.id
    140   			const streamKey = `call:${channelId}:1`
    141   			
    142   			let fn = async () => {
    143   				console.log("Completing quest", questName, "-", quest.config.messages.questName)
    144   				
    145   				while(true) {
    146   					const res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: false}})
    147   					const progress = res.body.progress.PLAY_ACTIVITY.value
    148   					console.log(`Quest progress: ${progress}/${secondsNeeded}`)
    149   					
    150   					await new Promise(resolve => setTimeout(resolve, 20 * 1000))
    151   					
    152   					if(progress >= secondsNeeded) {
    153   						await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: true}})
    154   						break
    155   					}
    156   				}
    157   				
    158   				console.log("Quest completed!")
    159   				doJob()
    160   			}
    161   			fn()
    162   		}
    163   	}
    164   	doJob()
    165   }
    166 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror