Last active 1 month ago

https://gist.github.com/aamiaa/204cd9d42013ded9faf646fae7f89fbb

csmith1865's Avatar csmith1865 revised this gist 1 month ago. Go to revision

1 file changed, 720 insertions, 18 deletions

CompleteDiscordQuest.md

@@ -1,13 +1,10 @@
1 1 ## Complete Recent Discord Quest
2 2
3 3 > [!NOTE]
4 - > This does not works in browser for non-video, non-activity quests! For stream/play quests use the desktop app!
5 -
6 - > [!NOTE]
7 - > When doing stream quests, you need at least 1 other account in the vc!
4 + > This does not works in browser for quests which require you to play a game! Use the [desktop app](https://discord.com/download) to complete those.
8 5
9 6 How to use this script:
10 - 1. Accept a quest under User Settings -> Gift Inventory
7 + 1. Accept a quest under Discover -> Quests
11 8 2. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
12 9 3. Go to the `Console` tab
13 10 4. Paste the following code and hit enter:
@@ -27,7 +24,7 @@ let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.get
27 24 let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.flushWaitQueue).exports.Z;
28 25 let api = Object.values(wpRequire.c).find(x => x?.exports?.tn?.get).exports.tn;
29 26
30 - let quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
27 + let quest = [...QuestsStore.quests.values()].find(x => x.id !== "1412491570820812933" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
31 28 let isApp = typeof DiscordNative !== "undefined"
32 29 if(!quest) {
33 30 console.log("You don't have any uncompleted quests!")
@@ -171,36 +168,41 @@ if(!quest) {
171 168 ```
172 169 </details>
173 170
171 + (If you're unable to paste into the console, you might have to type `allow pasting` and hit enter)
172 +
174 173 5. Follow the printed instructions depending on what type of quest you have
175 - - If your quest says to "play" the game, you can just wait and do nothing
174 + - If your quest says to "play" the game or watch a video, you can just wait and do nothing
176 175 - If your quest says to "stream" the game, join a vc with a friend or alt and stream any window
177 - 7. Wait for 15 minutes
178 - 8. You can now claim the reward in User Settings -> Gift Inventory!
176 + 7. Wait a bit for it to complete the quest
177 + 8. You can now claim the reward!
179 178
180 - 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.
179 + You can track the progress by looking at the `Quest progress:` prints in the Console tab, or by looking at the progress bar in the quests tab.
181 180
182 181 ## FAQ
183 182
184 - **Q: Ctrl + Shift + I doesn't work**
183 + **Q: Can I get banned for using this?**
184 +
185 + A: There is always a risk, though so far nobody has been banned for this or other similar things like client mods.
185 186
186 - 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
187 187
188 + **Q: Ctrl + Shift + I doesn't work**
189 +
190 + 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.
188 191
189 - **Q: I get an error saying "Unauthorized"**
190 192
191 - 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.
193 + **Q: Ctrl + Shift + I takes a screenshot**
192 194
193 - They have also started checking how many people are in the vc, so make sure you join it on at least 1 other account.
195 + A: Disable the keybind in your AMD Radeon app.
194 196
195 197
196 198 **Q: I get a syntax error/unexpected token error**
197 199
198 200 A: Make sure your browser isn't auto-translating this website before copying the script. Turn off any translator extensions and try again.
199 -
200 201
201 - **Q: I get the error `Cannot read properties of undefined (reading 'nativeModules')`**
202 202
203 - A: You're on a modded client which is a browser wrapper (i.e. Vesktop). Use an actual desktop app.
203 + **Q: I'm on Vesktop but it tells me that I'm using a browser**
204 +
205 + A: Vesktop is not a true desktop client, it's a fancy browser wrapper. Download the actual desktop app instead.
204 206
205 207
206 208 **Q: I get a different error**
@@ -208,10 +210,710 @@ A: You're on a modded client which is a browser wrapper (i.e. Vesktop). Use an a
208 210 A: Make sure you're copy/pasting the script correctly and that you've have done all the steps.
209 211
210 212
213 + **Q: Can I complete expired quests with this?**
214 +
215 + A: No, there is no way to do that.
216 +
217 +
211 218 **Q: Can you make the script auto accept the quest/reward?**
212 219
213 220 A: No. Both of those actions may show a captcha, so automating them is not a good idea. Just do the two clicks yourself.
214 221
222 +
223 + **Q: Can you make this a Vencord plugin?**
224 +
225 + A: No. The script sometimes requires immediate updates for Discord's changes, and Vencord's update cycle and code review would be too slow for that. There are some Vencord forks which have implemented this script or their own quest completers if you really want one.
226 +
227 +
228 + **Q: Can you upload the standalone script to a repo and make this gist's code a one line fetch()?**
229 +
230 + A: No. Doing that would put you at risk because I (or someone in my account) could change the underlying code to be malicious at any time, then forcepush it away later, and you'd never know.
231 +
232 + ## License (GPL-3.0)
233 +
234 + <details>
235 + <summary>Click to expand</summary>
236 +
237 +
238 + ```txt
239 + GNU GENERAL PUBLIC LICENSE
240 + Version 3, 29 June 2007
241 +
242 + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
243 + Everyone is permitted to copy and distribute verbatim copies
244 + of this license document, but changing it is not allowed.
245 +
246 + Preamble
247 +
248 + The GNU General Public License is a free, copyleft license for
249 + software and other kinds of works.
250 +
251 + The licenses for most software and other practical works are designed
252 + to take away your freedom to share and change the works. By contrast,
253 + the GNU General Public License is intended to guarantee your freedom to
254 + share and change all versions of a program--to make sure it remains free
255 + software for all its users. We, the Free Software Foundation, use the
256 + GNU General Public License for most of our software; it applies also to
257 + any other work released this way by its authors. You can apply it to
258 + your programs, too.
259 +
260 + When we speak of free software, we are referring to freedom, not
261 + price. Our General Public Licenses are designed to make sure that you
262 + have the freedom to distribute copies of free software (and charge for
263 + them if you wish), that you receive source code or can get it if you
264 + want it, that you can change the software or use pieces of it in new
265 + free programs, and that you know you can do these things.
266 +
267 + To protect your rights, we need to prevent others from denying you
268 + these rights or asking you to surrender the rights. Therefore, you have
269 + certain responsibilities if you distribute copies of the software, or if
270 + you modify it: responsibilities to respect the freedom of others.
271 +
272 + For example, if you distribute copies of such a program, whether
273 + gratis or for a fee, you must pass on to the recipients the same
274 + freedoms that you received. You must make sure that they, too, receive
275 + or can get the source code. And you must show them these terms so they
276 + know their rights.
277 +
278 + Developers that use the GNU GPL protect your rights with two steps:
279 + (1) assert copyright on the software, and (2) offer you this License
280 + giving you legal permission to copy, distribute and/or modify it.
281 +
282 + For the developers' and authors' protection, the GPL clearly explains
283 + that there is no warranty for this free software. For both users' and
284 + authors' sake, the GPL requires that modified versions be marked as
285 + changed, so that their problems will not be attributed erroneously to
286 + authors of previous versions.
287 +
288 + Some devices are designed to deny users access to install or run
289 + modified versions of the software inside them, although the manufacturer
290 + can do so. This is fundamentally incompatible with the aim of
291 + protecting users' freedom to change the software. The systematic
292 + pattern of such abuse occurs in the area of products for individuals to
293 + use, which is precisely where it is most unacceptable. Therefore, we
294 + have designed this version of the GPL to prohibit the practice for those
295 + products. If such problems arise substantially in other domains, we
296 + stand ready to extend this provision to those domains in future versions
297 + of the GPL, as needed to protect the freedom of users.
298 +
299 + Finally, every program is threatened constantly by software patents.
300 + States should not allow patents to restrict development and use of
301 + software on general-purpose computers, but in those that do, we wish to
302 + avoid the special danger that patents applied to a free program could
303 + make it effectively proprietary. To prevent this, the GPL assures that
304 + patents cannot be used to render the program non-free.
305 +
306 + The precise terms and conditions for copying, distribution and
307 + modification follow.
308 +
309 + TERMS AND CONDITIONS
310 +
311 + 0. Definitions.
312 +
313 + "This License" refers to version 3 of the GNU General Public License.
314 +
315 + "Copyright" also means copyright-like laws that apply to other kinds of
316 + works, such as semiconductor masks.
317 +
318 + "The Program" refers to any copyrightable work licensed under this
319 + License. Each licensee is addressed as "you". "Licensees" and
320 + "recipients" may be individuals or organizations.
321 +
322 + To "modify" a work means to copy from or adapt all or part of the work
323 + in a fashion requiring copyright permission, other than the making of an
324 + exact copy. The resulting work is called a "modified version" of the
325 + earlier work or a work "based on" the earlier work.
326 +
327 + A "covered work" means either the unmodified Program or a work based
328 + on the Program.
329 +
330 + To "propagate" a work means to do anything with it that, without
331 + permission, would make you directly or secondarily liable for
332 + infringement under applicable copyright law, except executing it on a
333 + computer or modifying a private copy. Propagation includes copying,
334 + distribution (with or without modification), making available to the
335 + public, and in some countries other activities as well.
336 +
337 + To "convey" a work means any kind of propagation that enables other
338 + parties to make or receive copies. Mere interaction with a user through
339 + a computer network, with no transfer of a copy, is not conveying.
340 +
341 + An interactive user interface displays "Appropriate Legal Notices"
342 + to the extent that it includes a convenient and prominently visible
343 + feature that (1) displays an appropriate copyright notice, and (2)
344 + tells the user that there is no warranty for the work (except to the
345 + extent that warranties are provided), that licensees may convey the
346 + work under this License, and how to view a copy of this License. If
347 + the interface presents a list of user commands or options, such as a
348 + menu, a prominent item in the list meets this criterion.
349 +
350 + 1. Source Code.
351 +
352 + The "source code" for a work means the preferred form of the work
353 + for making modifications to it. "Object code" means any non-source
354 + form of a work.
355 +
356 + A "Standard Interface" means an interface that either is an official
357 + standard defined by a recognized standards body, or, in the case of
358 + interfaces specified for a particular programming language, one that
359 + is widely used among developers working in that language.
360 +
361 + The "System Libraries" of an executable work include anything, other
362 + than the work as a whole, that (a) is included in the normal form of
363 + packaging a Major Component, but which is not part of that Major
364 + Component, and (b) serves only to enable use of the work with that
365 + Major Component, or to implement a Standard Interface for which an
366 + implementation is available to the public in source code form. A
367 + "Major Component", in this context, means a major essential component
368 + (kernel, window system, and so on) of the specific operating system
369 + (if any) on which the executable work runs, or a compiler used to
370 + produce the work, or an object code interpreter used to run it.
371 +
372 + The "Corresponding Source" for a work in object code form means all
373 + the source code needed to generate, install, and (for an executable
374 + work) run the object code and to modify the work, including scripts to
375 + control those activities. However, it does not include the work's
376 + System Libraries, or general-purpose tools or generally available free
377 + programs which are used unmodified in performing those activities but
378 + which are not part of the work. For example, Corresponding Source
379 + includes interface definition files associated with source files for
380 + the work, and the source code for shared libraries and dynamically
381 + linked subprograms that the work is specifically designed to require,
382 + such as by intimate data communication or control flow between those
383 + subprograms and other parts of the work.
384 +
385 + The Corresponding Source need not include anything that users
386 + can regenerate automatically from other parts of the Corresponding
387 + Source.
388 +
389 + The Corresponding Source for a work in source code form is that
390 + same work.
391 +
392 + 2. Basic Permissions.
393 +
394 + All rights granted under this License are granted for the term of
395 + copyright on the Program, and are irrevocable provided the stated
396 + conditions are met. This License explicitly affirms your unlimited
397 + permission to run the unmodified Program. The output from running a
398 + covered work is covered by this License only if the output, given its
399 + content, constitutes a covered work. This License acknowledges your
400 + rights of fair use or other equivalent, as provided by copyright law.
401 +
402 + You may make, run and propagate covered works that you do not
403 + convey, without conditions so long as your license otherwise remains
404 + in force. You may convey covered works to others for the sole purpose
405 + of having them make modifications exclusively for you, or provide you
406 + with facilities for running those works, provided that you comply with
407 + the terms of this License in conveying all material for which you do
408 + not control copyright. Those thus making or running the covered works
409 + for you must do so exclusively on your behalf, under your direction
410 + and control, on terms that prohibit them from making any copies of
411 + your copyrighted material outside their relationship with you.
412 +
413 + Conveying under any other circumstances is permitted solely under
414 + the conditions stated below. Sublicensing is not allowed; section 10
415 + makes it unnecessary.
416 +
417 + 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
418 +
419 + No covered work shall be deemed part of an effective technological
420 + measure under any applicable law fulfilling obligations under article
421 + 11 of the WIPO copyright treaty adopted on 20 December 1996, or
422 + similar laws prohibiting or restricting circumvention of such
423 + measures.
424 +
425 + When you convey a covered work, you waive any legal power to forbid
426 + circumvention of technological measures to the extent such circumvention
427 + is effected by exercising rights under this License with respect to
428 + the covered work, and you disclaim any intention to limit operation or
429 + modification of the work as a means of enforcing, against the work's
430 + users, your or third parties' legal rights to forbid circumvention of
431 + technological measures.
432 +
433 + 4. Conveying Verbatim Copies.
434 +
435 + You may convey verbatim copies of the Program's source code as you
436 + receive it, in any medium, provided that you conspicuously and
437 + appropriately publish on each copy an appropriate copyright notice;
438 + keep intact all notices stating that this License and any
439 + non-permissive terms added in accord with section 7 apply to the code;
440 + keep intact all notices of the absence of any warranty; and give all
441 + recipients a copy of this License along with the Program.
442 +
443 + You may charge any price or no price for each copy that you convey,
444 + and you may offer support or warranty protection for a fee.
445 +
446 + 5. Conveying Modified Source Versions.
447 +
448 + You may convey a work based on the Program, or the modifications to
449 + produce it from the Program, in the form of source code under the
450 + terms of section 4, provided that you also meet all of these conditions:
451 +
452 + a) The work must carry prominent notices stating that you modified
453 + it, and giving a relevant date.
454 +
455 + b) The work must carry prominent notices stating that it is
456 + released under this License and any conditions added under section
457 + 7. This requirement modifies the requirement in section 4 to
458 + "keep intact all notices".
459 +
460 + c) You must license the entire work, as a whole, under this
461 + License to anyone who comes into possession of a copy. This
462 + License will therefore apply, along with any applicable section 7
463 + additional terms, to the whole of the work, and all its parts,
464 + regardless of how they are packaged. This License gives no
465 + permission to license the work in any other way, but it does not
466 + invalidate such permission if you have separately received it.
467 +
468 + d) If the work has interactive user interfaces, each must display
469 + Appropriate Legal Notices; however, if the Program has interactive
470 + interfaces that do not display Appropriate Legal Notices, your
471 + work need not make them do so.
472 +
473 + A compilation of a covered work with other separate and independent
474 + works, which are not by their nature extensions of the covered work,
475 + and which are not combined with it such as to form a larger program,
476 + in or on a volume of a storage or distribution medium, is called an
477 + "aggregate" if the compilation and its resulting copyright are not
478 + used to limit the access or legal rights of the compilation's users
479 + beyond what the individual works permit. Inclusion of a covered work
480 + in an aggregate does not cause this License to apply to the other
481 + parts of the aggregate.
482 +
483 + 6. Conveying Non-Source Forms.
484 +
485 + You may convey a covered work in object code form under the terms
486 + of sections 4 and 5, provided that you also convey the
487 + machine-readable Corresponding Source under the terms of this License,
488 + in one of these ways:
489 +
490 + a) Convey the object code in, or embodied in, a physical product
491 + (including a physical distribution medium), accompanied by the
492 + Corresponding Source fixed on a durable physical medium
493 + customarily used for software interchange.
494 +
495 + b) Convey the object code in, or embodied in, a physical product
496 + (including a physical distribution medium), accompanied by a
497 + written offer, valid for at least three years and valid for as
498 + long as you offer spare parts or customer support for that product
499 + model, to give anyone who possesses the object code either (1) a
500 + copy of the Corresponding Source for all the software in the
501 + product that is covered by this License, on a durable physical
502 + medium customarily used for software interchange, for a price no
503 + more than your reasonable cost of physically performing this
504 + conveying of source, or (2) access to copy the
505 + Corresponding Source from a network server at no charge.
506 +
507 + c) Convey individual copies of the object code with a copy of the
508 + written offer to provide the Corresponding Source. This
509 + alternative is allowed only occasionally and noncommercially, and
510 + only if you received the object code with such an offer, in accord
511 + with subsection 6b.
512 +
513 + d) Convey the object code by offering access from a designated
514 + place (gratis or for a charge), and offer equivalent access to the
515 + Corresponding Source in the same way through the same place at no
516 + further charge. You need not require recipients to copy the
517 + Corresponding Source along with the object code. If the place to
518 + copy the object code is a network server, the Corresponding Source
519 + may be on a different server (operated by you or a third party)
520 + that supports equivalent copying facilities, provided you maintain
521 + clear directions next to the object code saying where to find the
522 + Corresponding Source. Regardless of what server hosts the
523 + Corresponding Source, you remain obligated to ensure that it is
524 + available for as long as needed to satisfy these requirements.
525 +
526 + e) Convey the object code using peer-to-peer transmission, provided
527 + you inform other peers where the object code and Corresponding
528 + Source of the work are being offered to the general public at no
529 + charge under subsection 6d.
530 +
531 + A separable portion of the object code, whose source code is excluded
532 + from the Corresponding Source as a System Library, need not be
533 + included in conveying the object code work.
534 +
535 + A "User Product" is either (1) a "consumer product", which means any
536 + tangible personal property which is normally used for personal, family,
537 + or household purposes, or (2) anything designed or sold for incorporation
538 + into a dwelling. In determining whether a product is a consumer product,
539 + doubtful cases shall be resolved in favor of coverage. For a particular
540 + product received by a particular user, "normally used" refers to a
541 + typical or common use of that class of product, regardless of the status
542 + of the particular user or of the way in which the particular user
543 + actually uses, or expects or is expected to use, the product. A product
544 + is a consumer product regardless of whether the product has substantial
545 + commercial, industrial or non-consumer uses, unless such uses represent
546 + the only significant mode of use of the product.
547 +
548 + "Installation Information" for a User Product means any methods,
549 + procedures, authorization keys, or other information required to install
550 + and execute modified versions of a covered work in that User Product from
551 + a modified version of its Corresponding Source. The information must
552 + suffice to ensure that the continued functioning of the modified object
553 + code is in no case prevented or interfered with solely because
554 + modification has been made.
555 +
556 + If you convey an object code work under this section in, or with, or
557 + specifically for use in, a User Product, and the conveying occurs as
558 + part of a transaction in which the right of possession and use of the
559 + User Product is transferred to the recipient in perpetuity or for a
560 + fixed term (regardless of how the transaction is characterized), the
561 + Corresponding Source conveyed under this section must be accompanied
562 + by the Installation Information. But this requirement does not apply
563 + if neither you nor any third party retains the ability to install
564 + modified object code on the User Product (for example, the work has
565 + been installed in ROM).
566 +
567 + The requirement to provide Installation Information does not include a
568 + requirement to continue to provide support service, warranty, or updates
569 + for a work that has been modified or installed by the recipient, or for
570 + the User Product in which it has been modified or installed. Access to a
571 + network may be denied when the modification itself materially and
572 + adversely affects the operation of the network or violates the rules and
573 + protocols for communication across the network.
574 +
575 + Corresponding Source conveyed, and Installation Information provided,
576 + in accord with this section must be in a format that is publicly
577 + documented (and with an implementation available to the public in
578 + source code form), and must require no special password or key for
579 + unpacking, reading or copying.
580 +
581 + 7. Additional Terms.
582 +
583 + "Additional permissions" are terms that supplement the terms of this
584 + License by making exceptions from one or more of its conditions.
585 + Additional permissions that are applicable to the entire Program shall
586 + be treated as though they were included in this License, to the extent
587 + that they are valid under applicable law. If additional permissions
588 + apply only to part of the Program, that part may be used separately
589 + under those permissions, but the entire Program remains governed by
590 + this License without regard to the additional permissions.
591 +
592 + When you convey a copy of a covered work, you may at your option
593 + remove any additional permissions from that copy, or from any part of
594 + it. (Additional permissions may be written to require their own
595 + removal in certain cases when you modify the work.) You may place
596 + additional permissions on material, added by you to a covered work,
597 + for which you have or can give appropriate copyright permission.
598 +
599 + Notwithstanding any other provision of this License, for material you
600 + add to a covered work, you may (if authorized by the copyright holders of
601 + that material) supplement the terms of this License with terms:
602 +
603 + a) Disclaiming warranty or limiting liability differently from the
604 + terms of sections 15 and 16 of this License; or
605 +
606 + b) Requiring preservation of specified reasonable legal notices or
607 + author attributions in that material or in the Appropriate Legal
608 + Notices displayed by works containing it; or
609 +
610 + c) Prohibiting misrepresentation of the origin of that material, or
611 + requiring that modified versions of such material be marked in
612 + reasonable ways as different from the original version; or
613 +
614 + d) Limiting the use for publicity purposes of names of licensors or
615 + authors of the material; or
616 +
617 + e) Declining to grant rights under trademark law for use of some
618 + trade names, trademarks, or service marks; or
619 +
620 + f) Requiring indemnification of licensors and authors of that
621 + material by anyone who conveys the material (or modified versions of
622 + it) with contractual assumptions of liability to the recipient, for
623 + any liability that these contractual assumptions directly impose on
624 + those licensors and authors.
625 +
626 + All other non-permissive additional terms are considered "further
627 + restrictions" within the meaning of section 10. If the Program as you
628 + received it, or any part of it, contains a notice stating that it is
629 + governed by this License along with a term that is a further
630 + restriction, you may remove that term. If a license document contains
631 + a further restriction but permits relicensing or conveying under this
632 + License, you may add to a covered work material governed by the terms
633 + of that license document, provided that the further restriction does
634 + not survive such relicensing or conveying.
635 +
636 + If you add terms to a covered work in accord with this section, you
637 + must place, in the relevant source files, a statement of the
638 + additional terms that apply to those files, or a notice indicating
639 + where to find the applicable terms.
640 +
641 + Additional terms, permissive or non-permissive, may be stated in the
642 + form of a separately written license, or stated as exceptions;
643 + the above requirements apply either way.
644 +
645 + 8. Termination.
646 +
647 + You may not propagate or modify a covered work except as expressly
648 + provided under this License. Any attempt otherwise to propagate or
649 + modify it is void, and will automatically terminate your rights under
650 + this License (including any patent licenses granted under the third
651 + paragraph of section 11).
652 +
653 + However, if you cease all violation of this License, then your
654 + license from a particular copyright holder is reinstated (a)
655 + provisionally, unless and until the copyright holder explicitly and
656 + finally terminates your license, and (b) permanently, if the copyright
657 + holder fails to notify you of the violation by some reasonable means
658 + prior to 60 days after the cessation.
659 +
660 + Moreover, your license from a particular copyright holder is
661 + reinstated permanently if the copyright holder notifies you of the
662 + violation by some reasonable means, this is the first time you have
663 + received notice of violation of this License (for any work) from that
664 + copyright holder, and you cure the violation prior to 30 days after
665 + your receipt of the notice.
666 +
667 + Termination of your rights under this section does not terminate the
668 + licenses of parties who have received copies or rights from you under
669 + this License. If your rights have been terminated and not permanently
670 + reinstated, you do not qualify to receive new licenses for the same
671 + material under section 10.
672 +
673 + 9. Acceptance Not Required for Having Copies.
674 +
675 + You are not required to accept this License in order to receive or
676 + run a copy of the Program. Ancillary propagation of a covered work
677 + occurring solely as a consequence of using peer-to-peer transmission
678 + to receive a copy likewise does not require acceptance. However,
679 + nothing other than this License grants you permission to propagate or
680 + modify any covered work. These actions infringe copyright if you do
681 + not accept this License. Therefore, by modifying or propagating a
682 + covered work, you indicate your acceptance of this License to do so.
683 +
684 + 10. Automatic Licensing of Downstream Recipients.
685 +
686 + Each time you convey a covered work, the recipient automatically
687 + receives a license from the original licensors, to run, modify and
688 + propagate that work, subject to this License. You are not responsible
689 + for enforcing compliance by third parties with this License.
690 +
691 + An "entity transaction" is a transaction transferring control of an
692 + organization, or substantially all assets of one, or subdividing an
693 + organization, or merging organizations. If propagation of a covered
694 + work results from an entity transaction, each party to that
695 + transaction who receives a copy of the work also receives whatever
696 + licenses to the work the party's predecessor in interest had or could
697 + give under the previous paragraph, plus a right to possession of the
698 + Corresponding Source of the work from the predecessor in interest, if
699 + the predecessor has it or can get it with reasonable efforts.
700 +
701 + You may not impose any further restrictions on the exercise of the
702 + rights granted or affirmed under this License. For example, you may
703 + not impose a license fee, royalty, or other charge for exercise of
704 + rights granted under this License, and you may not initiate litigation
705 + (including a cross-claim or counterclaim in a lawsuit) alleging that
706 + any patent claim is infringed by making, using, selling, offering for
707 + sale, or importing the Program or any portion of it.
708 +
709 + 11. Patents.
710 +
711 + A "contributor" is a copyright holder who authorizes use under this
712 + License of the Program or a work on which the Program is based. The
713 + work thus licensed is called the contributor's "contributor version".
714 +
715 + A contributor's "essential patent claims" are all patent claims
716 + owned or controlled by the contributor, whether already acquired or
717 + hereafter acquired, that would be infringed by some manner, permitted
718 + by this License, of making, using, or selling its contributor version,
719 + but do not include claims that would be infringed only as a
720 + consequence of further modification of the contributor version. For
721 + purposes of this definition, "control" includes the right to grant
722 + patent sublicenses in a manner consistent with the requirements of
723 + this License.
724 +
725 + Each contributor grants you a non-exclusive, worldwide, royalty-free
726 + patent license under the contributor's essential patent claims, to
727 + make, use, sell, offer for sale, import and otherwise run, modify and
728 + propagate the contents of its contributor version.
729 +
730 + In the following three paragraphs, a "patent license" is any express
731 + agreement or commitment, however denominated, not to enforce a patent
732 + (such as an express permission to practice a patent or covenant not to
733 + sue for patent infringement). To "grant" such a patent license to a
734 + party means to make such an agreement or commitment not to enforce a
735 + patent against the party.
736 +
737 + If you convey a covered work, knowingly relying on a patent license,
738 + and the Corresponding Source of the work is not available for anyone
739 + to copy, free of charge and under the terms of this License, through a
740 + publicly available network server or other readily accessible means,
741 + then you must either (1) cause the Corresponding Source to be so
742 + available, or (2) arrange to deprive yourself of the benefit of the
743 + patent license for this particular work, or (3) arrange, in a manner
744 + consistent with the requirements of this License, to extend the patent
745 + license to downstream recipients. "Knowingly relying" means you have
746 + actual knowledge that, but for the patent license, your conveying the
747 + covered work in a country, or your recipient's use of the covered work
748 + in a country, would infringe one or more identifiable patents in that
749 + country that you have reason to believe are valid.
750 +
751 + If, pursuant to or in connection with a single transaction or
752 + arrangement, you convey, or propagate by procuring conveyance of, a
753 + covered work, and grant a patent license to some of the parties
754 + receiving the covered work authorizing them to use, propagate, modify
755 + or convey a specific copy of the covered work, then the patent license
756 + you grant is automatically extended to all recipients of the covered
757 + work and works based on it.
758 +
759 + A patent license is "discriminatory" if it does not include within
760 + the scope of its coverage, prohibits the exercise of, or is
761 + conditioned on the non-exercise of one or more of the rights that are
762 + specifically granted under this License. You may not convey a covered
763 + work if you are a party to an arrangement with a third party that is
764 + in the business of distributing software, under which you make payment
765 + to the third party based on the extent of your activity of conveying
766 + the work, and under which the third party grants, to any of the
767 + parties who would receive the covered work from you, a discriminatory
768 + patent license (a) in connection with copies of the covered work
769 + conveyed by you (or copies made from those copies), or (b) primarily
770 + for and in connection with specific products or compilations that
771 + contain the covered work, unless you entered into that arrangement,
772 + or that patent license was granted, prior to 28 March 2007.
773 +
774 + Nothing in this License shall be construed as excluding or limiting
775 + any implied license or other defenses to infringement that may
776 + otherwise be available to you under applicable patent law.
777 +
778 + 12. No Surrender of Others' Freedom.
779 +
780 + If conditions are imposed on you (whether by court order, agreement or
781 + otherwise) that contradict the conditions of this License, they do not
782 + excuse you from the conditions of this License. If you cannot convey a
783 + covered work so as to satisfy simultaneously your obligations under this
784 + License and any other pertinent obligations, then as a consequence you may
785 + not convey it at all. For example, if you agree to terms that obligate you
786 + to collect a royalty for further conveying from those to whom you convey
787 + the Program, the only way you could satisfy both those terms and this
788 + License would be to refrain entirely from conveying the Program.
789 +
790 + 13. Use with the GNU Affero General Public License.
791 +
792 + Notwithstanding any other provision of this License, you have
793 + permission to link or combine any covered work with a work licensed
794 + under version 3 of the GNU Affero General Public License into a single
795 + combined work, and to convey the resulting work. The terms of this
796 + License will continue to apply to the part which is the covered work,
797 + but the special requirements of the GNU Affero General Public License,
798 + section 13, concerning interaction through a network will apply to the
799 + combination as such.
800 +
801 + 14. Revised Versions of this License.
802 +
803 + The Free Software Foundation may publish revised and/or new versions of
804 + the GNU General Public License from time to time. Such new versions will
805 + be similar in spirit to the present version, but may differ in detail to
806 + address new problems or concerns.
807 +
808 + Each version is given a distinguishing version number. If the
809 + Program specifies that a certain numbered version of the GNU General
810 + Public License "or any later version" applies to it, you have the
811 + option of following the terms and conditions either of that numbered
812 + version or of any later version published by the Free Software
813 + Foundation. If the Program does not specify a version number of the
814 + GNU General Public License, you may choose any version ever published
815 + by the Free Software Foundation.
816 +
817 + If the Program specifies that a proxy can decide which future
818 + versions of the GNU General Public License can be used, that proxy's
819 + public statement of acceptance of a version permanently authorizes you
820 + to choose that version for the Program.
821 +
822 + Later license versions may give you additional or different
823 + permissions. However, no additional obligations are imposed on any
824 + author or copyright holder as a result of your choosing to follow a
825 + later version.
826 +
827 + 15. Disclaimer of Warranty.
828 +
829 + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
830 + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
831 + HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
832 + OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
833 + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
834 + PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
835 + IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
836 + ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
837 +
838 + 16. Limitation of Liability.
839 +
840 + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
841 + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
842 + THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
843 + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
844 + USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
845 + DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
846 + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
847 + EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
848 + SUCH DAMAGES.
849 +
850 + 17. Interpretation of Sections 15 and 16.
851 +
852 + If the disclaimer of warranty and limitation of liability provided
853 + above cannot be given local legal effect according to their terms,
854 + reviewing courts shall apply local law that most closely approximates
855 + an absolute waiver of all civil liability in connection with the
856 + Program, unless a warranty or assumption of liability accompanies a
857 + copy of the Program in return for a fee.
858 +
859 + END OF TERMS AND CONDITIONS
860 +
861 + How to Apply These Terms to Your New Programs
862 +
863 + If you develop a new program, and you want it to be of the greatest
864 + possible use to the public, the best way to achieve this is to make it
865 + free software which everyone can redistribute and change under these terms.
866 +
867 + To do so, attach the following notices to the program. It is safest
868 + to attach them to the start of each source file to most effectively
869 + state the exclusion of warranty; and each file should have at least
870 + the "copyright" line and a pointer to where the full notice is found.
871 +
872 + <one line to give the program's name and a brief idea of what it does.>
873 + Copyright (C) <year> <name of author>
874 +
875 + This program is free software: you can redistribute it and/or modify
876 + it under the terms of the GNU General Public License as published by
877 + the Free Software Foundation, either version 3 of the License, or
878 + (at your option) any later version.
879 +
880 + This program is distributed in the hope that it will be useful,
881 + but WITHOUT ANY WARRANTY; without even the implied warranty of
882 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
883 + GNU General Public License for more details.
884 +
885 + You should have received a copy of the GNU General Public License
886 + along with this program. If not, see <https://www.gnu.org/licenses/>.
887 +
888 + Also add information on how to contact you by electronic and paper mail.
889 +
890 + If the program does terminal interaction, make it output a short
891 + notice like this when it starts in an interactive mode:
892 +
893 + <program> Copyright (C) <year> <name of author>
894 + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
895 + This is free software, and you are welcome to redistribute it
896 + under certain conditions; type `show c' for details.
897 +
898 + The hypothetical commands `show w' and `show c' should show the appropriate
899 + parts of the General Public License. Of course, your program's commands
900 + might be different; for a GUI interface, you would use an "about box".
901 +
902 + You should also get your employer (if you work as a programmer) or school,
903 + if any, to sign a "copyright disclaimer" for the program, if necessary.
904 + For more information on this, and how to apply and follow the GNU GPL, see
905 + <https://www.gnu.org/licenses/>.
906 +
907 + The GNU General Public License does not permit incorporating your program
908 + into proprietary programs. If your program is a subroutine library, you
909 + may consider it more useful to permit linking proprietary applications with
910 + the library. If this is what you want to do, use the GNU Lesser General
911 + Public License instead of this License. But first, please read
912 + <https://www.gnu.org/licenses/why-not-lgpl.html>.
913 + ```
914 +
915 + </details>
916 +
215 917 ___
216 918
217 919 <sup>Side note: Please don't post your "fixed" or "improved" versions of the script in the comments. It creates unnecessary confusion, often doesn't fix anything, and sometimes puts other people's accounts at risk. I might redact/delete such comments without notice. Thank you for understanding.</sup>

csmith1865's Avatar csmith1865 revised this gist 4 months ago. Go to revision

1 file changed, 91 insertions, 80 deletions

CompleteDiscordQuest.md

@@ -16,19 +16,19 @@ How to use this script:
16 16
17 17 ```js
18 18 delete window.$;
19 - let wpRequire;
20 - window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
19 + let wpRequire = webpackChunkdiscord_app.push([[Symbol()], {}, r => r]);
20 + webpackChunkdiscord_app.pop();
21 21
22 - let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getStreamerActiveStreamMetadata).exports.Z;
22 + let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.getStreamerActiveStreamMetadata).exports.Z;
23 23 let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getRunningGames).exports.ZP;
24 - let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getQuest).exports.Z;
25 - let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getAllThreadsForParent).exports.Z;
24 + let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.getQuest).exports.Z;
25 + let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.getAllThreadsForParent).exports.Z;
26 26 let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getSFWDefaultChannel).exports.ZP;
27 - let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.flushWaitQueue).exports.Z;
27 + let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.__proto__?.flushWaitQueue).exports.Z;
28 28 let api = Object.values(wpRequire.c).find(x => x?.exports?.tn?.get).exports.tn;
29 29
30 30 let quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
31 - let isApp = navigator.userAgent.includes("Electron/")
31 + let isApp = typeof DiscordNative !== "undefined"
32 32 if(!quest) {
33 33 console.log("You don't have any uncompleted quests!")
34 34 } else {
@@ -36,108 +36,119 @@ if(!quest) {
36 36
37 37 const applicationId = quest.config.application.id
38 38 const applicationName = quest.config.application.name
39 - const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY"].find(x => quest.config.taskConfig.tasks[x] != null)
40 - const secondsNeeded = quest.config.taskConfig.tasks[taskName].target
41 - const secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0
42 -
43 - if(taskName === "WATCH_VIDEO") {
44 - const tolerance = 2, speed = 10
45 - const diff = Math.floor((Date.now() - new Date(quest.userStatus.enrolledAt).getTime())/1000)
46 - const startingPoint = Math.min(Math.max(Math.ceil(secondsDone), diff), secondsNeeded)
47 - let fn = async () => {
48 - for(let i=startingPoint;i<=secondsNeeded;i+=speed) {
49 - try {
50 - await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, i + Math.random())}})
51 - } catch(ex) {
52 - console.log("Failed to send increment of", i, ex.message)
39 + const questName = quest.config.messages.questName
40 + const taskConfig = quest.config.taskConfig ?? quest.config.taskConfigV2
41 + const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY", "WATCH_VIDEO_ON_MOBILE"].find(x => taskConfig.tasks[x] != null)
42 + const secondsNeeded = taskConfig.tasks[taskName].target
43 + let secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0
44 +
45 + if(taskName === "WATCH_VIDEO" || taskName === "WATCH_VIDEO_ON_MOBILE") {
46 + const maxFuture = 10, speed = 7, interval = 1
47 + const enrolledAt = new Date(quest.userStatus.enrolledAt).getTime()
48 + let completed = false
49 + let fn = async () => {
50 + while(true) {
51 + const maxAllowed = Math.floor((Date.now() - enrolledAt)/1000) + maxFuture
52 + const diff = maxAllowed - secondsDone
53 + const timestamp = secondsDone + speed
54 + if(diff >= speed) {
55 + const res = await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, timestamp + Math.random())}})
56 + completed = res.body.completed_at != null
57 + secondsDone = Math.min(secondsNeeded, timestamp)
58 + }
59 +
60 + if(timestamp >= secondsNeeded) {
61 + break
53 62 }
54 - await new Promise(resolve => setTimeout(resolve, tolerance * 1000))
63 + await new Promise(resolve => setTimeout(resolve, interval * 1000))
55 64 }
56 - if((secondsNeeded-secondsDone)%speed !== 0) {
65 + if(!completed) {
57 66 await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: secondsNeeded}})
58 67 }
59 68 console.log("Quest completed!")
60 69 }
61 70 fn()
62 - console.log(`Spoofing video for ${applicationName}. Wait for ${Math.ceil((secondsNeeded - startingPoint)/speed*tolerance)} more seconds.`)
71 + console.log(`Spoofing video for ${questName}.`)
63 72 } else if(taskName === "PLAY_ON_DESKTOP") {
64 73 if(!isApp) {
65 - console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
74 + console.log("This no longer works in browser for non-video quests. Use the discord desktop app to complete the", questName, "quest!")
75 + } else {
76 + api.get({url: `/applications/public?application_ids=${applicationId}`}).then(res => {
77 + const appData = res.body[0]
78 + const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
79 +
80 + const fakeGame = {
81 + cmdLine: `C:\\Program Files\\${appData.name}\\${exeName}`,
82 + exeName,
83 + exePath: `c:/program files/${appData.name.toLowerCase()}/${exeName}`,
84 + hidden: false,
85 + isLauncher: false,
86 + id: applicationId,
87 + name: appData.name,
88 + pid: pid,
89 + pidPath: [pid],
90 + processName: appData.name,
91 + start: Date.now(),
92 + }
93 + const realGames = RunningGameStore.getRunningGames()
94 + const fakeGames = [fakeGame]
95 + const realGetRunningGames = RunningGameStore.getRunningGames
96 + const realGetGameForPID = RunningGameStore.getGameForPID
97 + RunningGameStore.getRunningGames = () => fakeGames
98 + RunningGameStore.getGameForPID = (pid) => fakeGames.find(x => x.pid === pid)
99 + FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: realGames, added: [fakeGame], games: fakeGames})
100 +
101 + let fn = data => {
102 + let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.PLAY_ON_DESKTOP.value)
103 + console.log(`Quest progress: ${progress}/${secondsNeeded}`)
104 +
105 + if(progress >= secondsNeeded) {
106 + console.log("Quest completed!")
107 +
108 + RunningGameStore.getRunningGames = realGetRunningGames
109 + RunningGameStore.getGameForPID = realGetGameForPID
110 + FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [fakeGame], added: [], games: []})
111 + FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
112 + }
113 + }
114 + FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
115 +
116 + console.log(`Spoofed your game to ${applicationName}. Wait for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
117 + })
66 118 }
67 -
68 - api.get({url: `/applications/public?application_ids=${applicationId}`}).then(res => {
69 - const appData = res.body[0]
70 - const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
71 -
72 - const games = RunningGameStore.getRunningGames()
73 - const fakeGame = {
74 - cmdLine: `C:\\Program Files\\${appData.name}\\${exeName}`,
75 - exeName,
76 - exePath: `c:/program files/${appData.name.toLowerCase()}/${exeName}`,
77 - hidden: false,
78 - isLauncher: false,
119 + } else if(taskName === "STREAM_ON_DESKTOP") {
120 + if(!isApp) {
121 + console.log("This no longer works in browser for non-video quests. Use the discord desktop app to complete the", questName, "quest!")
122 + } else {
123 + let realFunc = ApplicationStreamingStore.getStreamerActiveStreamMetadata
124 + ApplicationStreamingStore.getStreamerActiveStreamMetadata = () => ({
79 125 id: applicationId,
80 - name: appData.name,
81 - pid: pid,
82 - pidPath: [pid],
83 - processName: appData.name,
84 - start: Date.now(),
85 - }
86 - games.push(fakeGame)
87 - FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [], added: [fakeGame], games: games})
126 + pid,
127 + sourceName: null
128 + })
88 129
89 130 let fn = data => {
90 - let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.PLAY_ON_DESKTOP.value)
131 + let progress = quest.config.configVersion === 1 ? data.userStatus.streamProgressSeconds : Math.floor(data.userStatus.progress.STREAM_ON_DESKTOP.value)
91 132 console.log(`Quest progress: ${progress}/${secondsNeeded}`)
92 133
93 134 if(progress >= secondsNeeded) {
94 135 console.log("Quest completed!")
95 136
96 - const idx = games.indexOf(fakeGame)
97 - if(idx > -1) {
98 - games.splice(idx, 1)
99 - FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [fakeGame], added: [], games: []})
100 - }
137 + ApplicationStreamingStore.getStreamerActiveStreamMetadata = realFunc
101 138 FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
102 139 }
103 140 }
104 141 FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
105 142
106 - console.log(`Spoofed your game to ${applicationName}. Wait for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
107 - })
108 - } else if(taskName === "STREAM_ON_DESKTOP") {
109 - if(!isApp) {
110 - console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
111 - }
112 -
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 - }
143 + console.log(`Spoofed your stream to ${applicationName}. Stream any window in vc for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
144 + console.log("Remember that you need at least 1 other person to be in the vc!")
130 145 }
131 - FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
132 -
133 - console.log(`Spoofed your stream to ${applicationName}. Stream any window in vc for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
134 - console.log("Remember that you need at least 1 other person to be in the vc!")
135 146 } else if(taskName === "PLAY_ACTIVITY") {
136 147 const channelId = ChannelStore.getSortedPrivateChannels()[0]?.id ?? Object.values(GuildChannelStore.getAllGuilds()).find(x => x != null && x.VOCAL.length > 0).VOCAL[0].channel.id
137 148 const streamKey = `call:${channelId}:1`
138 149
139 150 let fn = async () => {
140 - console.log("Completing quest", applicationName, "-", quest.config.messages.questName)
151 + console.log("Completing quest", questName, "-", quest.config.messages.questName)
141 152
142 153 while(true) {
143 154 const res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: false}})

csmith1865's Avatar csmith1865 revised this gist 11 months ago. Go to revision

1 file changed, 206 insertions

CompleteDiscordQuest.md(file created)

@@ -0,0 +1,206 @@
1 + ## Complete Recent Discord Quest
2 +
3 + > [!NOTE]
4 + > This does not works in browser for non-video, non-activity quests! For stream/play quests use the desktop app!
5 +
6 + > [!NOTE]
7 + > When doing stream quests, you need at least 1 other account in the vc!
8 +
9 + How to use this script:
10 + 1. Accept a quest under User Settings -> Gift Inventory
11 + 2. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open DevTools
12 + 3. Go to the `Console` tab
13 + 4. Paste the following code and hit enter:
14 + <details>
15 + <summary>Click to expand</summary>
16 +
17 + ```js
18 + delete window.$;
19 + let wpRequire;
20 + window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
21 +
22 + let ApplicationStreamingStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getStreamerActiveStreamMetadata).exports.Z;
23 + let RunningGameStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getRunningGames).exports.ZP;
24 + let QuestsStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getQuest).exports.Z;
25 + let ChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.Z?.getAllThreadsForParent).exports.Z;
26 + let GuildChannelStore = Object.values(wpRequire.c).find(x => x?.exports?.ZP?.getSFWDefaultChannel).exports.ZP;
27 + let FluxDispatcher = Object.values(wpRequire.c).find(x => x?.exports?.Z?.flushWaitQueue).exports.Z;
28 + let api = Object.values(wpRequire.c).find(x => x?.exports?.tn?.get).exports.tn;
29 +
30 + let quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now())
31 + let isApp = navigator.userAgent.includes("Electron/")
32 + if(!quest) {
33 + console.log("You don't have any uncompleted quests!")
34 + } else {
35 + const pid = Math.floor(Math.random() * 30000) + 1000
36 +
37 + const applicationId = quest.config.application.id
38 + const applicationName = quest.config.application.name
39 + const taskName = ["WATCH_VIDEO", "PLAY_ON_DESKTOP", "STREAM_ON_DESKTOP", "PLAY_ACTIVITY"].find(x => quest.config.taskConfig.tasks[x] != null)
40 + const secondsNeeded = quest.config.taskConfig.tasks[taskName].target
41 + const secondsDone = quest.userStatus?.progress?.[taskName]?.value ?? 0
42 +
43 + if(taskName === "WATCH_VIDEO") {
44 + const tolerance = 2, speed = 10
45 + const diff = Math.floor((Date.now() - new Date(quest.userStatus.enrolledAt).getTime())/1000)
46 + const startingPoint = Math.min(Math.max(Math.ceil(secondsDone), diff), secondsNeeded)
47 + let fn = async () => {
48 + for(let i=startingPoint;i<=secondsNeeded;i+=speed) {
49 + try {
50 + await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: Math.min(secondsNeeded, i + Math.random())}})
51 + } catch(ex) {
52 + console.log("Failed to send increment of", i, ex.message)
53 + }
54 + await new Promise(resolve => setTimeout(resolve, tolerance * 1000))
55 + }
56 + if((secondsNeeded-secondsDone)%speed !== 0) {
57 + await api.post({url: `/quests/${quest.id}/video-progress`, body: {timestamp: secondsNeeded}})
58 + }
59 + console.log("Quest completed!")
60 + }
61 + fn()
62 + console.log(`Spoofing video for ${applicationName}. Wait for ${Math.ceil((secondsNeeded - startingPoint)/speed*tolerance)} more seconds.`)
63 + } else if(taskName === "PLAY_ON_DESKTOP") {
64 + if(!isApp) {
65 + console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
66 + }
67 +
68 + api.get({url: `/applications/public?application_ids=${applicationId}`}).then(res => {
69 + const appData = res.body[0]
70 + const exeName = appData.executables.find(x => x.os === "win32").name.replace(">","")
71 +
72 + const games = RunningGameStore.getRunningGames()
73 + const fakeGame = {
74 + cmdLine: `C:\\Program Files\\${appData.name}\\${exeName}`,
75 + exeName,
76 + exePath: `c:/program files/${appData.name.toLowerCase()}/${exeName}`,
77 + hidden: false,
78 + isLauncher: false,
79 + id: applicationId,
80 + name: appData.name,
81 + pid: pid,
82 + pidPath: [pid],
83 + processName: appData.name,
84 + start: Date.now(),
85 + }
86 + games.push(fakeGame)
87 + FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [], added: [fakeGame], games: games})
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 + const idx = games.indexOf(fakeGame)
97 + if(idx > -1) {
98 + games.splice(idx, 1)
99 + FluxDispatcher.dispatch({type: "RUNNING_GAMES_CHANGE", removed: [fakeGame], added: [], games: []})
100 + }
101 + FluxDispatcher.unsubscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
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 + } else if(taskName === "STREAM_ON_DESKTOP") {
109 + if(!isApp) {
110 + console.log("This no longer works in browser for non-video quests. Use the desktop app to complete the", applicationName, "quest!")
111 + }
112 +
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 + }
131 + FluxDispatcher.subscribe("QUESTS_SEND_HEARTBEAT_SUCCESS", fn)
132 +
133 + console.log(`Spoofed your stream to ${applicationName}. Stream any window in vc for ${Math.ceil((secondsNeeded - secondsDone) / 60)} more minutes.`)
134 + console.log("Remember that you need at least 1 other person to be in the vc!")
135 + } else if(taskName === "PLAY_ACTIVITY") {
136 + const channelId = ChannelStore.getSortedPrivateChannels()[0]?.id ?? Object.values(GuildChannelStore.getAllGuilds()).find(x => x != null && x.VOCAL.length > 0).VOCAL[0].channel.id
137 + const streamKey = `call:${channelId}:1`
138 +
139 + let fn = async () => {
140 + console.log("Completing quest", applicationName, "-", quest.config.messages.questName)
141 +
142 + while(true) {
143 + const res = await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: false}})
144 + const progress = res.body.progress.PLAY_ACTIVITY.value
145 + console.log(`Quest progress: ${progress}/${secondsNeeded}`)
146 +
147 + await new Promise(resolve => setTimeout(resolve, 20 * 1000))
148 +
149 + if(progress >= secondsNeeded) {
150 + await api.post({url: `/quests/${quest.id}/heartbeat`, body: {stream_key: streamKey, terminal: true}})
151 + break
152 + }
153 + }
154 +
155 + console.log("Quest completed!")
156 + }
157 + fn()
158 + }
159 + }
160 + ```
161 + </details>
162 +
163 + 5. Follow the printed instructions depending on what type of quest you have
164 + - If your quest says to "play" the game, you can just wait and do nothing
165 + - If your quest says to "stream" the game, join a vc with a friend or alt and stream any window
166 + 7. Wait for 15 minutes
167 + 8. You can now claim the reward in User Settings -> Gift Inventory!
168 +
169 + 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.
170 +
171 + ## FAQ
172 +
173 + **Q: Ctrl + Shift + I doesn't work**
174 +
175 + 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
176 +
177 +
178 + **Q: I get an error saying "Unauthorized"**
179 +
180 + 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.
181 +
182 + They have also started checking how many people are in the vc, so make sure you join it on at least 1 other account.
183 +
184 +
185 + **Q: I get a syntax error/unexpected token error**
186 +
187 + A: Make sure your browser isn't auto-translating this website before copying the script. Turn off any translator extensions and try again.
188 +
189 +
190 + **Q: I get the error `Cannot read properties of undefined (reading 'nativeModules')`**
191 +
192 + A: You're on a modded client which is a browser wrapper (i.e. Vesktop). Use an actual desktop app.
193 +
194 +
195 + **Q: I get a different error**
196 +
197 + A: Make sure you're copy/pasting the script correctly and that you've have done all the steps.
198 +
199 +
200 + **Q: Can you make the script auto accept the quest/reward?**
201 +
202 + A: No. Both of those actions may show a captcha, so automating them is not a good idea. Just do the two clicks yourself.
203 +
204 + ___
205 +
206 + <sup>Side note: Please don't post your "fixed" or "improved" versions of the script in the comments. It creates unnecessary confusion, often doesn't fix anything, and sometimes puts other people's accounts at risk. I might redact/delete such comments without notice. Thank you for understanding.</sup>
Newer Older