sopurr
I've been working on this JS library to operate Discord user accounts without browser emulation. It has a lot of features most other user-botting libraries don't, such as the ability to create accounts, join guilds, and send friend requests. Usually those API's are protected, but by making an HTTP client that mimics browser behavior, along with a lot of reverse engineering, I was able to bypass their security.
I've been deveoping it on and off for a few years now, and I would love to hear your feedback!
You can check it out here: [https://github.com/Sopur/Discord-user-bots](GitHub - Sopur/Discord-user-bots)
Thanks!
```js const config = { sleep: 10, max_requests: 20, log_time: 100, };
async function sleep(ms) { return new Promise((res) => setTimeout(res, ms)); }
async function click() { const res = await fetch("https://obscurebutton.com/api/clicks", { headers: { "content-type": "application/json", }, body: JSON.stringify({ increment: 10 }), method: "POST", });
try {
return (await res.json()).count;
} catch (e) {
return 0;
}
}void (async function main() { let countOld = 0; let countNew = 0; let activeReqs = 0;
setInterval(() => {
console.log(
`[${activeReqs}] ${countOld} (${((countNew - countOld) / config.log_time) * 1000}/sec)`
);
countOld = countNew;
}, config.log_time);
setInterval(async () => {
if (activeReqs >= config.max_requests) return;
activeReqs++;
countNew = (await click()) || countNew;
activeReqs--;
}, config.sleep);
})();
```Also in the future, do some input validation. Removing the `content-type` header causes a 502 internal server error to be returned.