├── README.md └── playground.py /README.md: -------------------------------------------------------------------------------- 1 | Discord Token Playground 2 | ======================== 3 | 4 | Simple Python script that automates requests to a Discord account via its token. 5 | 6 | ## Requirements 7 | First of all install the requests module 8 | ``` 9 | pip install requests 10 | ``` 11 | 12 | ## Usage. 13 | Put your token here 14 | ``` 15 | TOKEN = "" 16 | ``` 17 | Features: 18 | ``` 19 | dump_info() 20 | join_server() 21 | set_typing() 22 | send_message() 23 | send_mass_messages() 24 | set_bio() 25 | set_custom_status() 26 | change_status() 27 | change_language() 28 | change_theme() 29 | create_threads() 30 | create_guilds() 31 | clear_messages() 32 | delete_guilds() 33 | delete_channels() 34 | delete_friends() 35 | raid() 36 | ``` 37 | 38 | **NOTE:** If you change your password your token will change. 39 | 40 | ## Tested on: 41 | 42 | - Windows 10 43 | -------------------------------------------------------------------------------- /playground.py: -------------------------------------------------------------------------------- 1 | from threading import Thread 2 | from requests import Session 3 | import random 4 | import time 5 | import json 6 | 7 | TOKEN = "" 8 | 9 | 10 | class Playground: 11 | def __init__(self, token): 12 | self.token = token 13 | self.session = Session() 14 | self.session.headers = {"authorization": self.token, "content-type": "application/json"} 15 | 16 | self.api = "https://discord.com/api" 17 | 18 | self.username = None 19 | self.id = None 20 | self.email = None 21 | self.phone = None 22 | 23 | self._check() 24 | 25 | def _check(self): 26 | url = self.api + "/users/@me" 27 | r = self.session.get(url) 28 | 29 | if r.status_code == 200: 30 | print(f"Valid token: {self.token}") 31 | data = r.json() 32 | self.username = data['username'] 33 | self.id = data['id'] 34 | self.email = data['email'] 35 | self.phone = data['phone'] 36 | else: 37 | print(f"Invalid token: {self.token}") 38 | exit() 39 | 40 | def get_gifts(self): 41 | url = self.api + "/users/@me/entitlements/gifts" 42 | r = self.session.get(url) 43 | return r.json() if r.status_code == 200 else [] 44 | 45 | def get_user_channels(self): 46 | url = self.api + "/users/@me/channels" 47 | r = self.session.get(url) 48 | return r.json() if r.status_code == 200 else [] 49 | 50 | def get_guilds(self): 51 | url = self.api + "/users/@me/guilds" 52 | r = self.session.get(url) 53 | return r.json() if r.status_code == 200 else [] 54 | 55 | def get_friends(self): 56 | url = self.api + "/users/@me/relationships" 57 | r = self.session.get(url) 58 | return r.json() if r.status_code == 200 else [] 59 | 60 | def get_nitro(self): 61 | url = self.api + f"/users/{self.id}/profile" 62 | r = self.session.get(url) 63 | try: 64 | return bool(r.json()['premium_since']) 65 | except KeyError('premium_since'): 66 | return False 67 | 68 | def join_server(self, invite_code): 69 | invite_code = invite_code.replace("https://discord.gg/", "") 70 | url = self.api + f"/invites/{invite_code}" 71 | r = self.session.post(url) 72 | if r.status_code in [200, 201, 204]: 73 | print(f"{self.username} | Joined to {invite_code}") 74 | else: 75 | print(f"{self.username} | Error {r.text}") 76 | 77 | def set_typing(self, channel_id, amount=1): 78 | url = self.api + f"/channels/{channel_id}/typing" 79 | for _ in range(amount): 80 | r = self.session.post(url, json={}) 81 | if r.status_code in [200, 201, 204]: 82 | print(f"{self.username} | Sent typing request") 83 | else: 84 | print(f"{self.username} | Error {r.text}") 85 | 86 | def set_custom_status(self, status): 87 | url = self.api + "/users/@me/settings" 88 | payload = {"custom_status": {"text": status}} 89 | r = self.session.patch(url, json=payload) 90 | if r.status_code in [200, 201, 204]: 91 | print(f"{self.username} | Status changed to: {status}") 92 | else: 93 | print(f"{self.username} | Error: {r.text}") 94 | 95 | def set_bio(self, bio): 96 | url = self.api + "/users/@me" 97 | payload = {"bio": bio} 98 | r = self.session.patch(url, json=payload) 99 | if r.status_code in [200, 201, 204]: 100 | print(f"{self.username} | Bio changed to: {bio}") 101 | else: 102 | print(f"{self.username} | Error: {r.text}") 103 | 104 | def change_theme(self, theme): 105 | url = self.api + "/users/@me/settings" 106 | if theme in ["dark", "light"]: 107 | r = self.session.patch(url, json={"theme": theme}) 108 | if r.status_code in [200, 201, 204]: 109 | print(f"{self.username} | Theme changed to {theme}") 110 | else: 111 | print(f"{self.username} | Error: {r.text}") 112 | else: 113 | print(f"Invalid theme type, maybe you meant: 'dark' or 'light'") 114 | 115 | def change_status(self, status): 116 | url = self.api + "/users/@me/settings" 117 | statuses = ["online", "idle", "dnd", "invisible"] 118 | if status in statuses: 119 | payload = {"status": status} 120 | r = self.session.patch(url, json=payload) 121 | if r.status_code in [200, 201, 204]: 122 | print(f"{self.username} | Status changed to {status}") 123 | else: 124 | print(f"{self.username} | Error: {r.text}") 125 | else: 126 | print(f"Invalid status, maybe you meant: {statuses}") 127 | 128 | def change_language(self, language): 129 | languages = ["da", "de", "en-GB", "en-US", "es-EN", "fr", "hr", "it", "lt", "hu", 130 | "nl", "no", "pl", "pt-BR", "ro", "fi", "sv-SE", "vi", "tr", "cs", 131 | "el", "bg", "ru", "uk", "hi", "th", "zh-CN", "ja", "zh-TW", "ko"] 132 | url = self.api + "/users/@me/settings" 133 | if language in languages: 134 | r = self.session.patch(url, json={"locale": language}) 135 | if r.status_code in [200, 201, 204]: 136 | print(f"{self.username} | Language changed to {language}") 137 | else: 138 | print(f"{self.username} | Error: {r.text}") 139 | else: 140 | print(f"Invalid language, maybe you meant: {languages}") 141 | 142 | def send_message(self, msg, channel_id): 143 | url = self.api + f"/channels/{channel_id}/messages" 144 | data = {"content": msg} 145 | r = self.session.post(url, json=data) 146 | if r.status_code == 200: 147 | print(f"{self.username} | Message sent to {channel_id}") 148 | else: 149 | print(f"{self.username} | Error {r.status_code}: {channel_id}") 150 | 151 | def send_mass_messages(self, msg): 152 | total = 0 153 | for channel in self.get_user_channels(): 154 | self.send_message(msg, channel['id']) 155 | total += 1 156 | time.sleep(1) 157 | print(f"{self.username} | Sent {total} messages") 158 | 159 | def create_threads(self, channel, name, duration: int): 160 | url = self.api + f"/channels/{channel}/threads" 161 | payload = {"name": name, "type": 11, "auto_archive_duration": duration} 162 | r = self.session.post(url, json=payload) 163 | if r.status_code in [200, 201, 204]: 164 | print(f"{self.username} | Created a thread at {channel}") 165 | else: 166 | print(f"{self.username} | Failed to create the thread at {channel}") 167 | 168 | def raid(self): 169 | Thread(target=self.create_guilds, args=["raided", 100]).start() 170 | Thread(target=self.delete_guilds).start() 171 | Thread(target=self.delete_friends).start() 172 | Thread(target=self.delete_channels).start() 173 | while True: 174 | languages = ["da", "de", "en-GB", "en-US", "es-EN", "fr", "hr", "it", "lt", "hu", 175 | "nl", "no", "pl", "pt-BR", "ro", "fi", "sv-SE", "vi", "tr", "cs", 176 | "el", "bg", "ru", "uk", "hi", "th", "zh-CN", "ja", "zh-TW", "ko"] 177 | self.change_language(random.choice(languages)) 178 | for i in range(2): 179 | theme = "dark" if i == 0 else "light" 180 | self.change_theme(theme) 181 | 182 | def get_payments(self): 183 | payment_types = ["Credit Card", "Paypal"] 184 | url = self.api + "/users/@me/billing/payment-sources" 185 | r = self.session.get(url) 186 | if r.status_code in [200, 201, 204]: 187 | payments = [] 188 | for data in r.json(): 189 | if int(data['type'] == 1): 190 | payments.append({'type': payment_types[int(data['type']) - 1], 191 | 'valid': not data['invalid'], 192 | 'brand': data['brand'], 193 | 'last 4': data['last_4'], 194 | 'expires': str(data['expires_year']) + "y " + str(data['expires_month']) + 'm', 195 | 'billing name': data['billing_address']['name'], 196 | 'country': data['billing_address']['country'], 197 | 'state': data['billing_address']['state'], 198 | 'city': data['billing_address']['city'], 199 | 'zip code': data['billing_address']['postal_code'], 200 | 'address': data['billing_address']['line_1'], }) 201 | else: 202 | payments.append({'type': payment_types[int(data['type']) - 1], 203 | 'valid': not data['invalid'], 204 | 'email': data['email'], 'billing name': data['billing_address']['name'], 205 | 'country': data['billing_address']['country'], 206 | 'state': data['billing_address']['state'], 207 | 'city': data['billing_address']['city'], 208 | 'zip code': data['billing_address']['postal_code'], 209 | 'address': data['billing_address']['line_1'], }) 210 | return payments 211 | else: 212 | return [] 213 | 214 | def get_messages(self, channel_id, page: int = 0): 215 | offset = 25 * page 216 | url = self.api + f"/channels/{channel_id}/messages/search?offset={offset}" 217 | r = self.session.get(url) 218 | if r.status_code in [200, 201, 204]: 219 | return r.json()["messages"] 220 | else: 221 | return [] 222 | 223 | def clear_messages(self, channel_id): 224 | # TODO: REDO 225 | pass 226 | # total_messages_url = self.api + f"/channels/{channel_id}/messages/search?author_id={self.id}" 227 | # total_messages = self.session.get(total_messages_url).json()["total_results"] 228 | # page = 0 229 | # total = 0 230 | # while total <= total_messages: 231 | # messages = self.get_messages(channel_id, page) 232 | # for message in messages: 233 | # if message[0]["author"]["id"] == self.id: 234 | # url = self.api + f"/channels/{channel_id}/messages/{message[0]['id']}" 235 | # r = self.session.delete(url) 236 | # print(r.status_code, r.text) 237 | # if r.status_code in [200, 201, 204]: 238 | # print(f"{self.username} | Deleted message {message[0]['id']}") 239 | # time.sleep(2) 240 | # total += 1 241 | # else: 242 | # print(r.status_code) 243 | # print(r.text) 244 | # page += 1 245 | # print(f"{self.username} | Deleted {total} messages in {channel_id}") 246 | 247 | def delete_friends(self): 248 | total = 0 249 | for friend in self.get_friends(): 250 | url = self.api + f"/users/@me/relationships/{friend['id']}" 251 | r = self.session.delete(url) 252 | if r.status_code in [200, 201, 204]: 253 | total += 1 254 | print(f"{self.username} | Deleted {total} friends") 255 | 256 | def delete_guilds(self, exceptions): 257 | total = 0 258 | for guild in self.get_guilds(): 259 | if guild["id"] in exceptions: 260 | continue 261 | if guild['owner']: 262 | url = self.api + f"/guilds/{guild['id']}/delete" 263 | r = self.session.post(url, json={}) 264 | if r.status_code in [200, 201, 204]: 265 | total += 1 266 | else: 267 | url = self.api + "/users/@me/guilds/{guild['id']}" 268 | self.session.delete(url, json={}) 269 | print(f"{self.username} | Deleted {total} guilds") 270 | 271 | def delete_channels(self): 272 | total = 0 273 | for channel in self.get_user_channels(): 274 | url = self.api + f"/channels/{channel['id']}" 275 | r = self.session.delete(url) 276 | if r.status_code in [200, 201, 204]: 277 | total += 1 278 | print(f"{self.username} | Deleted {total} channels") 279 | 280 | def create_guilds(self, name, amount: int): 281 | url = self.api + "/guilds" 282 | payload = {"name": name} 283 | total = 0 284 | for i in range(amount): 285 | r = self.session.post(url, json=payload) 286 | if r.status_code in [200, 201, 204]: 287 | total += 1 288 | print(f"{self.username} | created {total} servers") 289 | 290 | def dump_info(self, extra_info: bool = False): 291 | info = { 292 | "token": self.token, 293 | "username": self.username, 294 | "id": self.id, 295 | "email": self.email, 296 | "phone": self.phone, 297 | "nitro": self.get_nitro(), 298 | "gifts": self.get_gifts(), 299 | "payments": self.get_payments() 300 | } 301 | 302 | if extra_info: 303 | info["friends"] = self.get_friends(), 304 | info["user_dm"] = self.get_user_channels(), 305 | info["guilds"] = self.get_guilds() 306 | 307 | with open(f"{self.username}.json", "w") as f: 308 | json.dump(info, f, indent=4) 309 | print("Info dumped") 310 | 311 | 312 | if __name__ == '__main__': 313 | user = Playground(TOKEN) 314 | # user.dump_info(extra_info=True) 315 | # user.set_typing(channel_id="Channel") 316 | # user.send_message(msg=":neutral_face:", channel_id="831933264649519136") 317 | # user.send_mass_messages(msg="Msg") 318 | # user.set_bio(bio="New Bio") 319 | # user.set_custom_status(status="New status") 320 | # user.change_status() 321 | # user.change_language(language="Lang") 322 | # user.change_theme(theme="dark") 323 | # user.create_threads(channel="Channel", name="Name", duration=1400) 324 | # user.create_guilds(name="UwU", amount=100) 325 | # user.clear_messages(channel_id="914598955545952328") 326 | # user.delete_guilds() 327 | # user.delete_channels() 328 | # user.delete_friends() 329 | # user.raid() 330 | --------------------------------------------------------------------------------