Skip to content

Instantly share code, notes, and snippets.

@sorpdev
Forked from aamiaa/CompleteDiscordQuest.md
Last active April 27, 2024 02:41
Show Gist options
  • Save sorpdev/4e01688010ccdd44c2cdf92258ba9d0b to your computer and use it in GitHub Desktop.
Save sorpdev/4e01688010ccdd44c2cdf92258ba9d0b to your computer and use it in GitHub Desktop.

Revisions

  1. sorpdev revised this gist Apr 27, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -94,4 +94,4 @@ A: Make sure you've started streaming *before* running the script. Also make sur
    ## Visual changes
    ![image of added changes](changes.png)
    ![image of added changes](https://gist.github.com/sorpdev/4e01688010ccdd44c2cdf92258ba9d0b/raw/6e9aa3596670e2e71fdf0c59d0faaae69cc06c96/changes.png)
  2. sorpdev revised this gist Apr 27, 2024. 3 changed files with 74 additions and 9 deletions.
    34 changes: 25 additions & 9 deletions CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@
    ## Complete Recent Discord Quest
    <sup><b>Disclaimer:</b> This is just a purely cosmetical change of the [gist](https://gist.github.com/aamiaa/204cd9d42013ded9faf646fae7f89fbb) by [aamiaa](https://github.com/aamiaa)</sub>

    > [!NOTE]
    > This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string `Electron/` anywhere in your user-agent.
    > [!NOTE]
    > This no longer works if you're alone in vc! Somebody else has to join you!
    >
    > [!TIP]
    > If there is no other person available to be in the vc with you, you can do it with a second account using either Discord in your browser or Discord PTB (or the normal Discord Client if you're using the PTB build for opening the DevTools)
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    @@ -30,29 +34,37 @@ let streamData = ApplicationStreamingStore.getCurrentUserActiveStream()
    let isApp = navigator.userAgent.includes("Electron/")
    let isAloneInVC = streamData && Object.keys(VoiceStateStore.getVoiceStatesForChannel(streamData.channelId)).length === 1
    if(!isApp) {
    console.log("This no longer works in browser. Use the desktop app!")
    console.log('%c[DiscordQuestCompleter] %cThis no longer works in browser. Use the desktop app!', 'color: #bada55', 'font-weight: bold; color: #e54141');
    } else if(!quest) {
    console.log("You don't have any uncompleted quests!")
    console.log("%c[DiscordQuestCompleter] %cYou don't have any uncompleted quests!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else if(!streamData) {
    console.log("You haven't started a stream!")
    console.log("%c[DiscordQuestCompleter] %cYou haven't started a stream!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else if(isAloneInVC) {
    console.log("You need to join the vc on 1 other account!")
    console.log("%c[DiscordQuestCompleter] %cYou need to join the vc on 1 other account!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else {
    let streamId = encodeStreamKey(streamData)
    let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
    let getProgressionColorCode = (percentage) => {
    if(percentage < 25) return "#fb4b4b"
    if(percentage < 50) return "#ffa879"
    if(percentage < 75) return "#ffc163"
    if(percentage < 100) return "#feff5c"
    return "#c0ff33"
    }
    let heartbeat = async function() {
    console.log("Completing quest", quest.config.messages.gameTitle, "-", quest.config.messages.questName)
    console.log(`%c[DiscordQuestCompleter] %cCompleting quest ${quest.config.messages.gameTitle} - ${quest.config.messages.questName}`, 'color: #bada55', '');
    while(true) {
    let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}, headers: {"X-Discord-Resource-Optimization-Level": "1"}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/${secondsNeeded}`)
    progressPercentage = ((progress / secondsNeeded) * 100 | 0);
    console.log(`%c[DiscordQuestCompleter] %cQuest Progress ${progress}/${secondsNeeded} [ %c${progressPercentage + "%"} %c]`, 'color: #bada55', '', `color: ${getProgressionColorCode(progressPercentage)}`, '');

    if(progress >= secondsNeeded) break;
    await sleep(30 * 1000)
    }

    console.log("Quest completed!")
    console.log("%c[DiscordQuestCompleter] %cQuest completed!", 'color: #bada55', 'color: #44d618');
    }
    heartbeat()
    }
    @@ -78,4 +90,8 @@ They have also started checking how many people are in the vc, so make sure you
    **Q: I get a different error**
    A: Make sure you've started streaming *before* running the script. Also make sure you're copy/pasting it correctly.
    A: Make sure you've started streaming *before* running the script. Also make sure you're copy/pasting it correctly.
    ## Visual changes
    ![image of added changes](changes.png)
    Binary file added changes.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    49 changes: 49 additions & 0 deletions code.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    let wpRequire;
    window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

    let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
    let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
    let VoiceStateStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentClientVoiceChannelId).exports.default;
    let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
    let encodeStreamKey = Object.values(wpRequire.c).find(x => x?.exports?.encodeStreamKey).exports.encodeStreamKey;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

    let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
    let streamData = ApplicationStreamingStore.getCurrentUserActiveStream()
    let isApp = navigator.userAgent.includes("Electron/")
    let isAloneInVC = streamData && Object.keys(VoiceStateStore.getVoiceStatesForChannel(streamData.channelId)).length === 1
    if(!isApp) {
    console.log('%c[DiscordQuestCompleter] %cThis no longer works in browser. Use the desktop app!', 'color: #bada55', 'font-weight: bold; color: #e54141');
    } else if(!quest) {
    console.log("%c[DiscordQuestCompleter] %cYou don't have any uncompleted quests!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else if(!streamData) {
    console.log("%c[DiscordQuestCompleter] %cYou haven't started a stream!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else if(isAloneInVC) {
    console.log("%c[DiscordQuestCompleter] %cYou need to join the vc on 1 other account!", 'color: #bada55', 'font-weight: bold; color: #ffcc55');
    } else {
    let streamId = encodeStreamKey(streamData)
    let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
    let getProgressionColorCode = (percentage) => {
    if(percentage < 25) return "#fb4b4b"
    if(percentage < 50) return "#ffa879"
    if(percentage < 75) return "#ffc163"
    if(percentage < 100) return "#feff5c"
    return "#c0ff33"
    }
    let heartbeat = async function() {
    console.log(`%c[DiscordQuestCompleter] %cCompleting quest ${quest.config.messages.gameTitle} - ${quest.config.messages.questName}`, 'color: #bada55', '');
    while(true) {
    let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}, headers: {"X-Discord-Resource-Optimization-Level": "1"}})
    let progress = res.body.stream_progress_seconds

    progressPercentage = ((progress / secondsNeeded) * 100 | 0);
    console.log(`%c[DiscordQuestCompleter] %cQuest Progress ${progress}/${secondsNeeded} [ %c${progressPercentage + "%"} %c]`, 'color: #bada55', '', `color: ${getProgressionColorCode(progressPercentage)}`, '');

    if(progress >= secondsNeeded) break;
    await sleep(30 * 1000)
    }

    console.log("%c[DiscordQuestCompleter] %cQuest completed!", 'color: #bada55', 'color: #44d618');
    }
    heartbeat()
    }
  3. @aamiaa aamiaa revised this gist Apr 27, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ if(!isApp) {
    let heartbeat = async function() {
    console.log("Completing quest", quest.config.messages.gameTitle, "-", quest.config.messages.questName)
    while(true) {
    let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}})
    let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}, headers: {"X-Discord-Resource-Optimization-Level": "1"}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/${secondsNeeded}`)
  4. @aamiaa aamiaa revised this gist Apr 27, 2024. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    ## Complete Recent Discord Quest
    > [!NOTE]
    > This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string `Electron/` anywhere in your user-agent.
    > [!NOTE]
    > This no longer works if you're alone in vc! Somebody else has to join you!
    >
    How to use this script:
    @@ -75,4 +78,4 @@ They have also started checking how many people are in the vc, so make sure you
    **Q: I get a different error**
    A: Make sure you've started streaming *before* running the script
    A: Make sure you've started streaming *before* running the script. Also make sure you're copy/pasting it correctly.
  5. @aamiaa aamiaa revised this gist Apr 27, 2024. 1 changed file with 21 additions and 10 deletions.
    31 changes: 21 additions & 10 deletions CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -6,25 +6,36 @@
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    3. Stream any window (can be notepad or something)
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
    5. Go to the `Console` tab
    6. Paste the following code and hit enter:
    3. **Join the same vc on an alt**
    4. Stream any window (can be notepad or something)
    5. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
    6. Go to the `Console` tab
    7. Paste the following code and hit enter:
    ```js
    let wpRequire;
    window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

    let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
    let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
    let VoiceStateStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentClientVoiceChannelId).exports.default;
    let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
    let encodeStreamKey = Object.values(wpRequire.c).find(x => x?.exports?.encodeStreamKey).exports.encodeStreamKey;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

    let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt)
    if(!quest) {
    let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
    let streamData = ApplicationStreamingStore.getCurrentUserActiveStream()
    let isApp = navigator.userAgent.includes("Electron/")
    let isAloneInVC = streamData && Object.keys(VoiceStateStore.getVoiceStatesForChannel(streamData.channelId)).length === 1
    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 if(!streamData) {
    console.log("You haven't started a stream!")
    } else if(isAloneInVC) {
    console.log("You need to join the vc on 1 other account!")
    } else {
    let streamId = encodeStreamKey(ApplicationStreamingStore.getCurrentUserActiveStream())
    let streamId = encodeStreamKey(streamData)
    let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
    let heartbeat = async function() {
    console.log("Completing quest", quest.config.messages.gameTitle, "-", quest.config.messages.questName)
    @@ -48,8 +59,6 @@ if(!quest) {
    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. The progress should update every 30s.
    You do NOT need anybody watching your stream for this to work. You can be alone in vc just fine.
    ## FAQ
    **Q: Ctrl + Shift + I doesn't work**
    @@ -59,7 +68,9 @@ A: Either download the [ptb client](https://discord.com/api/downloads/distributi
    **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
    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**
  6. @aamiaa aamiaa revised this gist Apr 26, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ You do NOT need anybody watching your stream for this to work. You can be alone
    **Q: Ctrl + Shift + I doesn't work**
    A: Either download the [canary client](https://discord.com/api/downloads/distributions/app/installers/latest?channel=canary&platform=win&arch=x64), or use [this](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x/) to enable DevTools on stable
    A: Either download the [ptb client](https://discord.com/api/downloads/distributions/app/installers/latest?channel=ptb&platform=win&arch=x64), or use [this](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x/) to enable DevTools on stable
    **Q: I get an error saying "Unauthorized"**
  7. @aamiaa aamiaa revised this gist Apr 26, 2024. 1 changed file with 18 additions and 2 deletions.
    20 changes: 18 additions & 2 deletions CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    3. Stream any window (can be notepad or something)
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools (see [this](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x/) if it doesn't work)
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
    5. Go to the `Console` tab
    6. Paste the following code and hit enter:
    ```js
    @@ -48,4 +48,20 @@ if(!quest) {
    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. The progress should update every 30s.
    You do NOT need anybody watching your stream for this to work. You can be alone in vc just fine.
    You do NOT need anybody watching your stream for this to work. You can be alone in vc just fine.
    ## FAQ
    **Q: Ctrl + Shift + I doesn't work**
    A: Either download the [canary client](https://discord.com/api/downloads/distributions/app/installers/latest?channel=canary&platform=win&arch=x64), or use [this](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x/) 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
    **Q: I get a different error**
    A: Make sure you've started streaming *before* running the script
  8. @aamiaa aamiaa revised this gist Apr 26, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    3. Stream any window (can be notepad or something)
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools (see [this](https://www.reddit.com/r/discordapp/comments/sc61n3/comment/hu4fw5x/) if it doesn't work)
    5. Go to the `Console` tab
    6. Paste the following code and hit enter:
    ```js
  9. @aamiaa aamiaa revised this gist Apr 26, 2024. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    ## Complete Recent Discord Quest
    > [!NOTE]
    > This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string `Electron/` anywhere in your user-agent.
    >
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
  10. @aamiaa aamiaa revised this gist Apr 24, 2024. 1 changed file with 21 additions and 13 deletions.
    34 changes: 21 additions & 13 deletions CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Complete Discord Genshin Quest
    ## Complete Recent Discord Quest
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    @@ -12,24 +12,32 @@ window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire

    let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
    let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
    let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getQuest).exports.default;
    let encodeStreamKey = Object.values(wpRequire.c).find(x => x?.exports?.encodeStreamKey).exports.encodeStreamKey;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

    let streamId = encodeStreamKey(ApplicationStreamingStore.getCurrentUserActiveStream())
    let heartbeat = async function() {
    while(true) {
    let res = await api.post({url: "/quests/1227767407154561034/heartbeat", body: {stream_key: streamId}})
    let progress = res.body.stream_progress_seconds
    let quest = [...QuestsStore.quests.values()].find(x => x.userStatus?.enrolledAt && !x.userStatus?.completedAt)
    if(!quest) {
    console.log("You don't have any uncompleted quests!")
    } else {
    let streamId = encodeStreamKey(ApplicationStreamingStore.getCurrentUserActiveStream())
    let secondsNeeded = quest.config.streamDurationRequirementMinutes * 60
    let heartbeat = async function() {
    console.log("Completing quest", quest.config.messages.gameTitle, "-", quest.config.messages.questName)
    while(true) {
    let res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamId}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/${secondsNeeded}`)

    if(progress >= secondsNeeded) break;
    await sleep(30 * 1000)
    }

    console.log(`Quest progress: ${progress}/900`)

    if(progress >= 900) break;
    await sleep(30 * 1000)
    console.log("Quest completed!")
    }

    console.log("Quest completed!")
    heartbeat()
    }
    heartbeat()
    ```
    7. Keep the stream running for 15 minutes
    8. You can now claim the reward in User Settings -> Gift Inventory!
  11. @aamiaa aamiaa renamed this gist Apr 24, 2024. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions CompleteMokokoQuest.md → CompleteDiscordQuest.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Complete Discord Mokoko Quest
    ## Complete Discord Genshin Quest
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    @@ -18,7 +18,7 @@ let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
    let streamId = encodeStreamKey(ApplicationStreamingStore.getCurrentUserActiveStream())
    let heartbeat = async function() {
    while(true) {
    let res = await api.post({url: "/quests/1227395355193118750/heartbeat", body: {stream_key: streamId}})
    let res = await api.post({url: "/quests/1227767407154561034/heartbeat", body: {stream_key: streamId}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/900`)
    @@ -32,7 +32,7 @@ let heartbeat = async function() {
    heartbeat()
    ```
    7. Keep the stream running for 15 minutes
    8. You can now claim the decoration in User Settings -> Gift Inventory!
    8. 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. The progress should update every 30s.
  12. @aamiaa aamiaa revised this gist Apr 19, 2024. 1 changed file with 8 additions and 13 deletions.
    21 changes: 8 additions & 13 deletions CompleteMokokoQuest.md
    Original file line number Diff line number Diff line change
    @@ -11,21 +11,14 @@ let wpRequire;
    window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

    let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
    let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getSortedPrivateChannels).exports.default;
    let SelectedChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getVoiceChannelId).exports.default;
    let UserStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentUser).exports.default;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
    let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getStreamerActiveStreamMetadata).exports.default;
    let encodeStreamKey = Object.values(wpRequire.c).find(x => x?.exports?.encodeStreamKey).exports.encodeStreamKey;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

    let vc = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId())
    let streamId
    if(vc.guild_id) {
    streamId = `guild:${vc.guild_id}:${vc.id}:${UserStore.getCurrentUser().id}`
    } else {
    streamId = `call:${vc.id}:${UserStore.getCurrentUser().id}`
    }
    let streamId = encodeStreamKey(ApplicationStreamingStore.getCurrentUserActiveStream())
    let heartbeat = async function() {
    while(true) {
    let res = await api.post({url: "/quests/1227395355193118750/heartbeat", body: {stream_key:streamId}})
    let res = await api.post({url: "/quests/1227395355193118750/heartbeat", body: {stream_key: streamId}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/900`)
    @@ -41,4 +34,6 @@ heartbeat()
    7. Keep the stream running for 15 minutes
    8. You can now claim the decoration 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. The progress should update every 30s.
    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. The progress should update every 30s.
    You do NOT need anybody watching your stream for this to work. You can be alone in vc just fine.
  13. @aamiaa aamiaa revised this gist Apr 19, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CompleteMokokoQuest.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ let sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
    let vc = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId())
    let streamId
    if(vc.guild_id) {
    streamId = `guild:${vc.id}:${vc.id}:${UserStore.getCurrentUser().id}`
    streamId = `guild:${vc.guild_id}:${vc.id}:${UserStore.getCurrentUser().id}`
    } else {
    streamId = `call:${vc.id}:${UserStore.getCurrentUser().id}`
    }
  14. @aamiaa aamiaa revised this gist Apr 18, 2024. 1 changed file with 14 additions and 3 deletions.
    17 changes: 14 additions & 3 deletions CompleteMokokoQuest.md
    Original file line number Diff line number Diff line change
    @@ -16,18 +16,29 @@ let SelectedChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.defa
    let UserStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentUser).exports.default;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms))

    let vcId = SelectedChannelStore.getVoiceChannelId()
    let streamId = `guild:${ChannelStore.getChannel(vcId).guild_id}:${vcId}:${UserStore.getCurrentUser().id}`
    let vc = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId())
    let streamId
    if(vc.guild_id) {
    streamId = `guild:${vc.id}:${vc.id}:${UserStore.getCurrentUser().id}`
    } else {
    streamId = `call:${vc.id}:${UserStore.getCurrentUser().id}`
    }
    let heartbeat = async function() {
    while(true) {
    let res = await api.post({url: "/quests/1227395355193118750/heartbeat", body: {stream_key:streamId}})
    let progress = res.body.stream_progress_seconds

    console.log(`Quest progress: ${progress}/900`)

    if(progress >= 900) break;
    await sleep(30 * 1000)
    }

    console.log("Quest completed!")
    }
    heartbeat()
    ```
    7. Keep the stream running for 15 minutes
    8. You can now claim the decoration in User Settings -> Gift Inventory!
    8. You can now claim the decoration 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. The progress should update every 30s.
  15. @aamiaa aamiaa created this gist Apr 18, 2024.
    33 changes: 33 additions & 0 deletions CompleteMokokoQuest.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    ## Complete Discord Mokoko Quest
    How to use this script:
    1. Accept the quest under User Settings -> Gift Inventory
    2. Join a vc
    3. Stream any window (can be notepad or something)
    4. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
    5. Go to the `Console` tab
    6. Paste the following code and hit enter:
    ```js
    let wpRequire;
    window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);

    let api = Object.values(wpRequire.c).find(x => x?.exports?.getAPIBaseURL).exports.HTTP;
    let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getSortedPrivateChannels).exports.default;
    let SelectedChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getVoiceChannelId).exports.default;
    let UserStore = Object.values(wpRequire.c).find(x => x?.exports?.default?.getCurrentUser).exports.default;
    let sleep = ms => new Promise(resolve => setTimeout(resolve, ms))

    let vcId = SelectedChannelStore.getVoiceChannelId()
    let streamId = `guild:${ChannelStore.getChannel(vcId).guild_id}:${vcId}:${UserStore.getCurrentUser().id}`
    let heartbeat = async function() {
    while(true) {
    let res = await api.post({url: "/quests/1227395355193118750/heartbeat", body: {stream_key:streamId}})
    let progress = res.body.stream_progress_seconds

    if(progress >= 900) break;
    await sleep(30 * 1000)
    }
    }
    heartbeat()
    ```
    7. Keep the stream running for 15 minutes
    8. You can now claim the decoration in User Settings -> Gift Inventory!