Skip to content

Instantly share code, notes, and snippets.

@BussyBakks
Last active May 10, 2026 13:28
Show Gist options
  • Select an option

  • Save BussyBakks/1b30e9ba601bdce5f11edb7e29078db5 to your computer and use it in GitHub Desktop.

Select an option

Save BussyBakks/1b30e9ba601bdce5f11edb7e29078db5 to your computer and use it in GitHub Desktop.
FkrysQuestFarmer - a discord script for farming quests.

NOTE: If you want to run achievement activity quest, you must run the follow python script to host a simple web proxy. remember to pip install fastapi uvicorn

Under this file is the code.
Recommend using native discord app (DiscordCanary)
To get started, load the code bellow and type `FkrysQuestFarmer(true)` for only orb quests, `FkrysQuestFarmer(false)` to accept all available quests.


TODO:
- Make "auto-claim" possible (cus that route have captcha)
- ~~Port it into Vencord plugin, just for convenient i guess?~~ (nah it impossible)
- ... *update later*
/*
Copyright (R) 2024-2026 aamiaa and contributors
*/
delete window.$;
let wpRequire = webpackChunkdiscord_app.push([[Symbol()], {}, r => r]);
webpackChunkdiscord_app.pop();
let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getStreamerActiveStreamMetadata).exports.A;
let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.Ay?.getRunningGames).exports.Ay;
let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getQuest).exports.A;
let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getAllThreadsForParent).exports.A;
let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Ay?.getSFWDefaultChannel).exports.Ay;
let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.h?.__proto__?.flushWaitQueue).exports.h;
let api = Object.values(wpRequire.c).find(x => x?.exports?.Bo?.get).exports.Bo;
let isApp = typeof DiscordNative !== "undefined";
class FkrysLogger {
static #log(level, levelColor, args) {
console[level](
`%c FkrysQuestFarmer %c %c ${level.toUpperCase()} `,
`background: #669DF6; color: black; font-weight: bold; border-radius: 5px;`,
"",
`background: ${levelColor}; color: black; font-weight: bold; border-radius: 5px;`
, ...args
);
}
static info(...args) {
this.#log("info", "#a6d189", args);
}
static error(...args) {
this.#log("error", "#e78284", args);
}
static warn(...args) {
this.#log("warn", "#ffff67", args);
}
static debug(...args) {
this.#log("debug", "#eebebe", args);
}
}
const TheBestQuestWorkerEver = async (quest) => {
const pid = Math.floor(Math.random() * 30000) + 1000;
const applicationId = quest.config.application.id;
const applicationName = quest.config.application.name;
const questName = quest.config.messages.questName;
const taskConfig = quest.config.taskConfig ?? quest.config.taskConfigV2;
const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY", "WATCH_VIDEO_ON_MOBILE", "ACHIEVEMENT_IN_ACTIVITY"].find(x => taskConfig.tasks[x] != null);
const secondsNeeded = taskConfig.tasks[taskName]?.target ?? 0;
let secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0;
if (taskName === "WATCH_VIDEO" || taskName === "WATCH_VIDEO_ON_MOBILE") {
const speed = 7
const enrolledAt = new Date(quest.userStatus.enrolledAt).getTime();
let completed = false;
while (true) {
const remaining = Math.min(speed, secondsNeeded - secondsDone)
await new Promise(resolve => setTimeout(resolve, remaining * 1000))
const timestamp = secondsDone + speed;
const res = await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, timestamp + Math.random())}})
completed = res.body.completed_at != null
secondsDone = Math.min(secondsNeeded, timestamp)
if (timestamp >= secondsNeeded) break;
}
if (!completed) {
await api.post({
url: `/quests/${quest.id}/video-progress`,
body: {
timestamp: secondsNeeded
}
});
}
FkrysLogger.info("Quest completed:", questName);
} else if (taskName === "PLAY_ON_DESKTOP") {
if (!isApp) {
FkrysLogger.error("Desktop app required for:", questName);
} else {
const res = await api.get({
url: `/applications/public?application_ids=${applicationId}`
});
const appData = res.body[0];
const exeName = appData.executables?.find(x => x.os === "win32")?.name?.replace(">","") ?? appData.name.replace(/[\/\\:*?"<>|]/g, "")
const fakeGame = {
cmdLine: `C:\\Program Files (x86)\\${appData.name}\\${exeName}`,
exeName,
exePath: `c:/program files (x86)/${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
});
await new Promise(resolve => {
let fn = data => {
let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.PLAY_ON_DESKTOP.value);
FkrysLogger.info(`Quest progress: ${progress}/${secondsNeeded}`);
if (progress >= secondsNeeded) {
FkrysLogger.info("Quest completed:", questName);
RunningGameStore.getRunningGames = realGetRunningGames;
RunningGameStore.getGameForPID = realGetGameForPID;
FluxDispatcher.dispatch({
type: "RUNNING_GAMES_CHANGE",
removed: [fakeGame],
added: [],
games: []
});
FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn);
resolve();
}
};
FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn);
});
}
} else if (taskName === "STREAM_ON_DESKTOP") {
if (!isApp) {
FkrysLogger.error("Desktop app required for:", questName);
} else {
let realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata;
ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
id: applicationId,
pid,
sourceName: null
});
await new Promise(resolve => {
let fn = data => {
let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.STREAM_ON_DESKTOP.value);
FkrysLogger.info(`Quest progress: ${progress}/${secondsNeeded}`);
if (progress >= secondsNeeded) {
FkrysLogger.info("Quest completed:", questName);
ApplicationStreamingStore.getStreamerActiveStreamMetadata = realFunc;
FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn);
resolve();
}
};
FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn);
});
}
} 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`;
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;
FkrysLogger.info(`Quest progress: ${progress}/${secondsNeeded}`);
if (progress >= secondsNeeded) {
await api.post({
url: `/quests/${quest.id}/heartbeat`,
body: {
stream_key: streamKey,
terminal: true
}
});
break;
}
await new Promise(r => setTimeout(r, 20 * 1000));
}
FkrysLogger.info("Quest completed:", questName);
} else if (taskName === "ACHIEVEMENT_IN_ACTIVITY") {
FkrysLogger.warn(`${questName} have type "${taskName}" still in development.`)
const requirements = taskConfig.tasks[taskName]?.requirements ?? [];
if (requirements.length > 0) {
for (const req of requirements) {
try {
await api.post({
url: `/quests/${quest.id}/assignments`,
body: {
application_id: applicationId,
assignment_id: req.assignmentId
}
});
FkrysLogger.info("Quest completed:", questName);
} catch (e) {
FkrysLogger.error(`Failed to complete assignment ${req.assignmentId}:`, e);
}
}
} else {
const target = taskConfig.tasks[taskName]?.target;
if (!target) {
return;
}
try {
const pingRes = await fetch("http://127.0.0.1:11092/questFarmerProxyPing", { method: "GET" });
} catch (e) {
FkrysLogger.warn(`Can't complete ${questName}, because of the proxy is offline. Make sure to run the proxy before running this script`);
FkrysLogger.warn(`'what proxy?' you may asked. It's on the same link you download this.`);
return;
}
FkrysLogger.info(`Attempting bypass for target: ${target}`);
try {
const authRes = await api.post({
url: `/oauth2/authorize?client_id=${applicationId}&response_type=code&scope=identify%20applications.entitlements&state=`,
body: { authorize: true }
});
const location = authRes?.body?.location;
const authCode = location ? new URL(location).searchParams.get("code") : null;
if (!authCode) {
FkrysLogger.error("Failed to extract OAuth code from authorization response.");
return
}
const proxyRes = await fetch("http://127.0.0.1:11092/doMilestoneQuest", {
method: "POST",
body: JSON.stringify({
app_id: applicationId,
auth_code: authCode,
target: target
})
});
if (proxyRes.ok) {
FkrysLogger.info("Quest completed:", questName);
} else {
const err = await proxyRes.json();
FkrysLogger.error(err.detail || `Proxy returned HTTP ${proxyRes.status}`);
}
} catch (e) {
FkrysLogger.error(`Milestone bypass failed for ${questName}:`, e);
}
}
}
}
const isQuestStarted = (q) => q.userStatus !== null
const isOrbsQuest = (q) => q.config.rewardsConfig.rewards.some(r => r?.messages?.name?.toLowerCase().includes("orb"))
const isQuestCompleted = (q) => q.userStatus.completedAt !== null
const OrbsQuestFarmer = async () => {
QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getQuest).exports.A;
console.log("\n\n----------------------------------------------------------------------------------------------------------------\n\n")
let quests = Array.from(QuestsStore.quests.values()).filter(data =>(new Date(data.config.expiresAt).getTime() > Date.now()));
if (quests.length === 0) {
FkrysLogger.error("You don't have any available quests! (requirements: Not expired)");
return;
}
for (let quest of quests) {
if (!isOrbsQuest(quest)) {
FkrysLogger.info(`Skipping ${quest.config.messages.questName}: Not an orb quest.`);
continue;
}
if (isQuestStarted(quest) && isQuestCompleted(quest)) {
FkrysLogger.info(`Skipping ${quest.config.messages.questName}: Already completed.`);
continue;
}
if (!isQuestStarted(quest)) {
FkrysLogger.info(`Quest ${quest.config.messages.questName} not started. Starting...`);
await api.post({
url: `/quests/${quest.id}/enroll`,
body: { is_targeted: false, location: 11, metadata_raw: null, metadata_sealed: null }
});
await new Promise(r => setTimeout(r, 1000));
quest = QuestsStore.quests.get(quest.id);
}
if (!quest.userStatus) {
quest.userStatus = {
enrolledAt: new Date().toISOString(),
progress: {},
completedAt: null
};
}
FkrysLogger.info(`Starting orb quest: ${quest.config.messages.questName} (Rewards: ${quest.config.rewardsConfig.rewards?.[0].messages.name})`);
try {
await TheBestQuestWorkerEver(quest);
} catch (e) {
FkrysLogger.error(`Worker failed:`, e);
}
}
FkrysLogger.info("All orb quests completed! Waiting for 5 minutes for rerun.");
FkrysLogger.info(`Timeout ID: ${setTimeout(OrbsQuestFarmer, 300000)} | Use: "clearTimeout(timeout ID)" to stop.`)
};
const NormalQuestFarmer = async () => {
QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getQuest).exports.A;
console.log("\n\n----------------------------------------------------------------------------------------------------------------\n\n")
let quests = Array.from(QuestsStore.quests.values()).filter(x =>new Date(x.config.expiresAt).getTime() > Date.now());
if (quests.length === 0) {
FkrysLogger.error("You don't have any available quests! (requirements: Not expired)");
return;
}
for (let quest of quests) {
if (isQuestStarted(quest) && isQuestCompleted(quest)) {
FkrysLogger.info(`Skipping ${quest.config.messages.questName}: Already completed.`);
continue;
}
if (!isQuestStarted(quest)) {
FkrysLogger.info(`Quest ${quest.config.messages.questName} not started. Starting...`);
await api.post({
url: `/quests/${quest.id}/enroll`,
body: { is_targeted: false, location: 11, metadata_raw: null, metadata_sealed: null }
});
await new Promise(r => setTimeout(r, 1000));
quest = QuestsStore.quests.get(quest.id);
}
if (!quest.userStatus) {
quest.userStatus = {
enrolledAt: new Date().toISOString(),
progress: {},
completedAt: null
};
}
FkrysLogger.info("Starting quest:", quest.config.messages.questName);
try {
await TheBestQuestWorkerEver(quest);
} catch (e) {
FkrysLogger.error(`Worker failed:`, e);
}
}
FkrysLogger.info("All quests completed! Waiting for 5 minutes for rerun.");
FkrysLogger.info(`Timeout ID: ${setTimeout(NormalQuestFarmer, 300000)} | Use: "clearTimeout(timeout ID)" to stop.`)
}
const SpecificQuestFarmer = async (questId) => {
QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.A?.__proto__?.getQuest).exports.A;
console.log("\n\n----------------------------------------------------------------------------------------------------------------\n\n")
let quests = Array.from(QuestsStore.quests.values()).filter(x =>new Date(x.config.expiresAt).getTime() > Date.now());
if (quests.length === 0) {
FkrysLogger.error("You don't have any available quests! (requirements: Not expired)");
return;
}
for (let quest of quests) {
if (quest.id == questId) {
if (isQuestStarted(quest) && isQuestCompleted(quest)) {
FkrysLogger.info(`Skipping ${quest.config.messages.questName}: Already completed.`);
continue;
}
if (!isQuestStarted(quest)) {
FkrysLogger.info(`Quest ${quest.config.messages.questName} not started. Starting...`);
await api.post({
url: `/quests/${quest.id}/enroll`,
body: { is_targeted: false, location: 11, metadata_raw: null, metadata_sealed: null }
});
await new Promise(r => setTimeout(r, 1000));
quest = QuestsStore.quests.get(quest.id);
}
if (!quest.userStatus) {
quest.userStatus = {
enrolledAt: new Date().toISOString(),
progress: {},
completedAt: null
};
}
FkrysLogger.info("Starting quest:", quest.config.messages.questName);
try {
await TheBestQuestWorkerEver(quest);
} catch (e) {
FkrysLogger.error(`Worker failed:`, e);
}
}
}
FkrysLogger.info("Quests completed!");
}
const FkrysQuestFarmer = (only_orbs) => {
if (only_orbs == true) {
OrbsQuestFarmer()
} else {
NormalQuestFarmer()
}
}
FkrysLogger.info(`FkrysQuestFarmer - a script for farming Discord quests.`)
FkrysLogger.info(`Made by Fkrystal (Discord: fkrystal.noppy).`)
FkrysLogger.info(`Original code by aamiaa on gist.`)
FkrysLogger.info(`Loaded successfully. Use "FkrysQuestFarmer(only_orbs={true or false})" to use.`)
FkrysLogger.warn(`This tool can be flagged! Use with caution!!`)
FkrysLogger.info(`Note: Let "only_orbs" to true if you only need to farm orbs. Otherwise will run a default aamiaa's code.`)
if (!isApp) {
FkrysLogger.warn(`Erm... Seems like you didn't run this script inside an actual Discord client.`)
FkrysLogger.warn(`If you still use this inside web client, some features may not work correctly.`)
FkrysLogger.warn(`Consider changing into DiscordCanary for stable use.`)
FkrysLogger.warn(`Download link: https://discord.com/api/downloads/distributions/app/installers/latest?channel=canary&platform=win&arch=x64`)
}
from fastapi import FastAPI, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
import json
import requests
import uvicorn
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["https://discord.com", "https://ptb.discord.com", "https://canary.discord.com"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/questFarmerProxyPing")
@app.options("/doMilestoneQuest")
@app.options("/questFarmerProxyPing")
def ping():
return 204
@app.post("/doMilestoneQuest")
async def run_proxy_quest(request: Request):
raw_body = await request.body()
payload = json.loads(raw_body)
app_id = payload["app_id"]
auth_code = payload["auth_code"]
target = payload["target"]
print(f"[*] Received quest task for App {app_id} (Target: {target})")
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
auth_url = f"https://{app_id}.discordsays.com/.proxy/acf/authorize"
token_res = requests.post(auth_url, json={"code": auth_code}, headers=headers)
if not token_res.ok:
print(f"[-] Auth Failed: {token_res.text}")
raise HTTPException(status_code=token_res.status_code, detail="Failed to get Activity Token.")
token = token_res.json().get("token")
prog_url = f"https://{app_id}.discordsays.com/.proxy/acf/quest/progress"
prog_headers = {**headers, "x-auth-token": token}
prog_res = requests.post(prog_url, json={"progress": target}, headers=prog_headers)
if not prog_res.ok:
print(f"[-] Progress Push Failed: {prog_res.text}")
raise HTTPException(status_code=prog_res.status_code, detail="Failed to update milestone progress.")
return {"status": "success", "message": "pushed!"}
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=11092)
@AppleSang
Copy link
Copy Markdown

pls, add auto claim in your code, it have auto captcha solver

@BussyBakks
Copy link
Copy Markdown
Author

pls, add auto claim in your code, it have auto captcha solver

find for me a captcha solver lol

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