10

Discord Experiments.js

 1 year ago
source link: https://gist.github.com/MeguminSama/2cae24c9e4c335c661fa94e72235d4c4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Allows you to enable experiments in the latest discord builds

Very useful! Thanks! heart

Author

MeguminSama commented on Jun 30, 2021

edited

I'll start deleting dumb comments from now on. Let me make a small FAQ.

Q: "I enabled an experiment but cant use it!!!!"
A: Discord locks many experiments on the API. Enabling it on the client does not bypass this.

Q: "omg ur gonna steal my details"
A: Read the code. It literally just changes a zero to a one (false -> true).

Q: "How to I disable this?"
A: Press CTRL+R to refresh the client, or fully close it from the taskbar and restart it.

Q: "It didn't work!!!"
A: Good for you. I'm not your support agent.

nobody:
code nobs: omg they change 0 to 1 thats crazy it can steal my password iperseverepersevereperseverefearfulfearfulfearfulfearfulscreamscreamscreamscreamcold_sweatcold_sweatscreamscream

nobody:
code nobs: omg they change 0 to 1 thats crazy it can steal my password iperseverepersevereperseverefearfulfearfulfearfulfearfulscreamscreamscreamscreamcold_sweatcold_sweatscreamscream

Other code nubs like me be: Oh its gonna heck my pass? Let it try.
Also other code nubs like me be: Oh random guy on internet who claims to be a dev says it works. I'll trust my privacy to him.
....
A few moments later
....
You will have to pay the IRS 5000 Dollars or Police will raid your house in 59:59

Author

MeguminSama commented on Sep 6, 2021

edited

Friendly reminder that it literally changes false to true, and even if you aren't a "techy" person, you can clearly see that it makes no external requests

Discord literally even tells you that if you are uncomfortable with pasting stuff, then don't do it.

Screenshot_20211004-172514

LOL

image
I don't know whether to be offended, or to laugh lol

thanks pal, I loved that QA disclaimer

13-05 commented on Mar 12

ggz, pog code

thanks

RossMdevs commented on Jun 16

As @MeguminSama stated,

Discord has learned from past mistakes to now hide experiments behind their API.

You'll be 403'd for a lot of the experiments

https://discord.com/api/v8/science

Example 403

kotx commented on Jun 16

@RossMdevs I don't know what you mean, those are build overrides, not experiments?

RossMdevs commented on Jun 17

@RossMdevs I don't know what you mean, those are build overrides, not experiments?

It’s an example of 1 of many 403’s you can get when enabling discord experiments.

XxUnkn0wnxX commented 2 days ago

edited

Current working code: Credits to HypedDomi#1711 | AAGaming#9395 (BetterDiscord Community)

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.default._dispatcher._dependencyGraph.nodes)
try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["CONNECTION_OPEN"]({user: {flags: 1}, type: "CONNECTION_OPEN"})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser

Author

MeguminSama commented 2 days ago

Thanks @XxUnkn0wnxX
I'm going to try finding a cleaner way of doing this. But this seems like the best thing to do for now :/

thanks

Current working code: Credits to HypedDomi#1711 | AAGaming#9395 (BetterDiscord Community)

@XxUnkn0wnxX Thank you for sharing this, when discord opens, do you have to paste this everytime in the debug console?

Current working code: Credits to HypedDomi#1711 | AAGaming#9395 (BetterDiscord Community)

@XxUnkn0wnxX Thank you for sharing this, when discord opens, do you have to paste this everytime in the debug console?

yes, every time you start or refresh discord you have to inject the code into your client.

also, quick question: when will the one currently displayed stop working, as i see someone has posted a new one, but the one on display still works on even the latest canary windows desktop client?

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.default._dispatcher._dependencyGraph.nodes)
try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["CONNECTION_OPEN"]({user: {flags: 1}, type: "CONNECTION_OPEN"})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser

Thanks a lot!

how do i keep the experimental feature on?
is there a code to auto paste it on start?

kotx commented 6 hours ago

how do i keep the experimental feature on? is there a code to auto paste it on start?

Powercord has a setting to always show the experiments tab.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK