From 2f909133aa6e2ae7ce52abdbac8d8851204fbf7e Mon Sep 17 00:00:00 2001 From: Tenclea Date: Mon, 1 Apr 2024 22:58:01 +0200 Subject: [PATCH] first commit --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ index.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 115 insertions(+) create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..a715a2d --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Discord Loot Box Opener 🎁 + +This project automates the process of opening loot boxes on Discord using a user's token. Follow these steps to set up and run the script. + +## Disclaimer ⚠️ + +This project is a Proof of Concept (POC) and is for educational purposes only. Using selfbot tools or scripts to automate actions on Discord, including opening loot boxes, is prohibited by Discord's Terms of Service. Utilizing this script on live Discord accounts can lead to account suspension or termination. Always use responsibly and ethically, and never use it in a way that violates Discord's Terms of Service. + + +## Pre-requisites 📋 +- [Node.js](https://nodejs.org/en/download) installed on your computer. +- Your Discord token. (⚠️ **Never share your token with others**) + +## Running the Script 🚀 + +1. **Start the Script** + +In the project directory, open your terminal or command prompt and run: + +``` +node index.js +``` + +This will start the script. + +2. **Input Your Token** + +The script will prompt you to 'Input your token: '. Paste your Discord token here and press Enter. + +⚠️ The script does not store your token anywhere, but always be cautious with your token to avoid misuse. + +3. **Profits!** + +The script will now start opening loot boxes once every 5 seconds for you. Enjoy! + +## How it Works 🧩 + +- The script uses your token to make authorized requests to Discord for opening loot boxes. +- It automatically handles rate limits imposed by Discord and retries opening a loot box after the specified wait time. +- Upon successfully opening a loot box, it will log the item you received to the console. + +## Troubleshooting 🛠 + +- **Invalid Token**: If you receive a 'The provided token seems to be invalid.' message, double-check your token and try again. +- **Rate Limits**: If rate-limited, the script will automatically wait and retry. No action is needed from your side. +- If your issue persists, feel free to open up an issue, describing as precisely as possible what is going wrong. + +## Security Note 🔐 + +- Your token is like a key to your Discord account. Never share it and only use it in trusted applications. + +## Contributing 🤝 + +Feel free to fork the project, make improvements, and submit pull requests. We're always looking to make our projects better! + +--- + +Happy Loot Box Opening! 🎉 \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..81f63aa --- /dev/null +++ b/index.js @@ -0,0 +1,56 @@ +import * as readline from 'readline'; + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +const token = await new Promise(r => rl.question('Input your token: ', r)); + +async function openBox() { + return fetch("https://discord.com/api/v9/users/@me/lootboxes/open", { + "headers": { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0", + "Accept": "*/*", + "Authorization": token, + "X-Super-Properties": "eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiRmlyZWZveCIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1VUyIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChXaW5kb3dzIE5UIDEwLjA7IFdpbjY0OyB4NjQ7IHJ2OjEyNC4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzEyNC4wIiwiYnJvd3Nlcl92ZXJzaW9uIjoiMTI0LjAiLCJvc192ZXJzaW9uIjoiMTAiLCJyZWZlcnJlciI6Imh0dHBzOi8vdGV0cmF6ZXJvLmNvbS8iLCJyZWZlcnJpbmdfZG9tYWluIjoidGV0cmF6ZXJvLmNvbSIsInJlZmVycmVyX2N1cnJlbnQiOiJodHRwczovL2Rpc2NvcmQuY29tLyIsInJlZmVycmluZ19kb21haW5fY3VycmVudCI6ImRpc2NvcmQuY29tIiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X2J1aWxkX251bWJlciI6MjgwNDU4LCJjbGllbnRfZXZlbnRfc291cmNlIjpudWxsfQ==", + }, + "referrer": "https://discord.com/shop", + "method": "POST", + }).then(r => r.json()).catch(() => { }); +} + +function wait(ms) { + return new Promise(r => setTimeout(r, ms)); +} + +for (; ; await wait(5000)) { + const res = await openBox(); + if (!res) { + console.error('Request failed.'); + continue; + } + + if (res.code == 0) { + console.error('The provided token seems to be invalid.'); + process.exit(1); + } + + if (res.retry_after) { + console.error(`Rate limited for: ${res.retry_after}s`); + await wait(res.retry_after * 1000 - 5000); + continue; + } + + const prize = res.opened_item; + if (!prize) { + console.error('An unknown error has occureed:', res); + continue; + } + + console.log('Congrats! You just got a: ' + { + '1214340999644446726': 'Quack!!', '1214340999644446724': '⮕⬆⬇⮕⬆⬇', '1214340999644446722': 'Wump Shell', + '1214340999644446720': 'Buster Blade', '1214340999644446725': 'Power Helmet', '1214340999644446723': 'Speed Boost', + '1214340999644446721': 'Cute Plushie', '1214340999644446728': 'Dream Hammer', '1214340999644446727': 'OHHHHH BANANA', + }[prize]); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..1632c2c --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{"type": "module"} \ No newline at end of file