Last active
April 24, 2025 05:04
-
-
Save lazuee/0ac35550a1f21177885a627813fc9126 to your computer and use it in GitHub Desktop.
Complete the Discord quest by running this code on the browser console. (Use Vencord Web / Vesktop)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
if (typeof Vencord === "undefined") return console.log("You need to run this on (Vencord Web/Vesktop) app to continue..."); | |
let ApplicationStreamingStore = Vencord.Webpack.findStore("ApplicationStreamingStore"); | |
let RunningGameStore = Vencord.Webpack.findStore("RunningGameStore"); | |
let QuestsStore = Vencord.Webpack.findStore("QuestsStore"); | |
let ChannelStore = Vencord.Webpack.findStore("ChannelStore"); | |
let GuildChannelStore = Vencord.Webpack.findStore("GuildChannelStore"); | |
let { FluxDispatcher, RestAPI } = Vencord.Webpack.Common; | |
const quest = [...QuestsStore.quests.values()].find((q) => q.userStatus?.enrolledAt && !q.userStatus?.completedAt && new Date(q.config.expiresAt).getTime() > Date.now()); | |
if (!quest) return console.log("You don't have any incomplete quests!"); | |
const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY"].find((task) => quest.config.taskConfig.tasks[task]); | |
const { id: applicationId, name: applicationName } = quest.config.application; | |
const { questName } = quest.config.messages; | |
const isApp = typeof VesktopNative !== "undefined"; | |
const pid = Math.floor(Math.random() * 30000) + 1000; | |
const secondsNeeded = quest.config.taskConfig.tasks[taskName]?.target || 0; | |
const secondsDone = quest.userStatus?.progress?.[taskName]?.value || 0; | |
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
const handleWatchVideo = async () => { | |
const speed = 10; | |
const tolerance = 2; | |
const diff = Math.floor((Date.now() - new Date(quest.userStatus.enrolledAt).getTime()) / 1000); | |
const startingPoint = Math.min(Math.max(Math.ceil(secondsDone), diff), secondsNeeded); | |
console.log(`Spoofing video for ${applicationName}. Estimated time: ${Math.ceil(((secondsNeeded - startingPoint) / speed) * tolerance)} seconds.`); | |
for (let i = startingPoint; i <= secondsNeeded; i += speed) { | |
try { | |
await RestAPI.post({ url: `/quests/${quest.id}/video-progress`, body: { timestamp: Math.min(secondsNeeded, i + Math.random()) } }); | |
} catch (err) { | |
console.log("Error at increment", i, err.message); | |
} | |
await wait(tolerance * 1000); | |
} | |
console.log("Quest completed!"); | |
}; | |
const handlePlayOnDesktop = async () => { | |
if (!isApp) return console.log(`Use the Vesktop app to complete the "${questName}" quest!`); | |
const appData = (await RestAPI.get({ url: `/applications/public?application_ids=${applicationId}` })).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, | |
pidPath: [pid], | |
processName: appData.name, | |
start: Date.now() | |
}; | |
games.push(fakeGame); | |
FluxDispatcher.dispatch({ type: "RUNNING_GAMES_CHANGE", removed: [], added: [fakeGame], games }); | |
const updateProgress = (data) => { | |
const progress = | |
quest.config.configVersion === 1 | |
? data.userStatus.streamProgressSeconds | |
: data.userStatus.progress.PLAY_ON_DESKTOP?.value || 0; | |
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",updateProgress); | |
} | |
}; | |
FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", updateProgress); | |
console.log(`Spoofed your game to ${applicationName}. Wait for ${Math.ceil((secondsNeeded - secondsDone) / 60)} minutes.`); | |
}; | |
const handleStreamOnDesktop = () => { | |
if (!isApp) return console.log(`Use the Vesktop app to complete the "${questName}" quest!`); | |
const activeStream = ApplicationStreamingStore.getCurrentUserActiveStream(); | |
const isAloneInVC = activeStream && Object.keys(VoiceStateStore.getVoiceStatesForChannel(activeStream.channelId)).length === 1; | |
if (!activeStream) return console.log(`Start streaming in the voice channel and wait until the "${questName}" quest is complete!`); | |
if (isAloneInVC) return console.log(`You need at least one member in the voice channel to complete the "${questName}" quest!`); | |
const realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata; | |
ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({ id: applicationId, pid, sourceName: null }); | |
const updateProgress = (data) => { | |
const progress = | |
quest.config.configVersion === 1 | |
? data.userStatus.streamProgressSeconds | |
: data.userStatus.progress.STREAM_ON_DESKTOP?.value || 0; | |
console.log(`Quest progress: ${progress}/${secondsNeeded}`); | |
if (progress >= secondsNeeded) { | |
console.log("Quest completed!"); | |
ApplicationStreamingStore.getStreamerActiveStreamMetadata = realFunc; | |
FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", updateProgress); | |
} | |
}; | |
FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", updateProgress); | |
console.log(`Spoofed your stream to ${applicationName}. Stream in VC for ${Math.ceil((secondsNeeded - secondsDone) / 60)} minutes.`); | |
}; | |
const handlePlayActivity = async () => { | |
const channelId = ChannelStore.getSortedPrivateChannels()[0]?.id || Object.values(GuildChannelStore.getAllGuilds()).find((guild) => guild?.VOCAL?.length)?.VOCAL[0]?.channel?.id; | |
const streamKey = `call:${channelId}:1`; | |
console.log(`Completing quest: ${applicationName}`); | |
while (true) { | |
const res = await RestAPI.post({ url: `/quests/${quest.id}/heartbeat`, body: { stream_key: streamKey, terminal: false } }); | |
const progress = res.body.progress.PLAY_ACTIVITY?.value || 0; | |
console.log(`Quest progress: ${progress}/${secondsNeeded}`); | |
if (progress >= secondsNeeded) { | |
await RestAPI.post({ url: `/quests/${quest.id}/heartbeat`, body: { stream_key: streamKey, terminal: true } }); | |
break; | |
} | |
await wait(20000); | |
} | |
console.log("Quest completed!"); | |
}; | |
if (taskName === "WATCH_VIDEO") handleWatchVideo(); | |
else if (taskName === "PLAY_ON_DESKTOP") handlePlayOnDesktop(); | |
else if (taskName === "STREAM_ON_DESKTOP") handleStreamOnDesktop(); | |
else if (taskName === "PLAY_ACTIVITY") handlePlayActivity(); | |
else console.log(`Cannot complete the "${questName}" quest because the task is not supported.`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ccto: https://gist.github.com/aamiaa/204cd9d42013ded9faf646fae7f89fbb