forked from cookkkie/discord-app-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
53 lines (43 loc) · 1.38 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import requests
import json
email = input('Email : ')
password = input('Password : ')
payload = {
'email': email,
'password': password
}
req = requests.post(url='https://discordapp.com/api/auth/login', json=payload)
if req.status_code != 200:
print('Error :/')
exit(1)
token = req.json()['token']
app_name = input('Application name : ')
description = input('Application description : ')
redirect_uri1 = input('Redirect URI 1 : ')
redirect_uri2 = input('Redirect URI 2 : ')
headers = {'Authorization': token}
payload = {
'name': app_name,
'description': description,
'redirect_uris': [redirect_uri1, redirect_uri2]
}
req = requests.post(url='https://discordapp.com/api/oauth2/applications', \
headers=headers,
json=payload)
if req.status_code != 201:
print('Error :/')
exit(1)
print('Storing bot details in {}.json'.format('app_name'))
with open('{}.json'.format('app_name'), 'w+') as f:
f.write(req.text)
req = requests.post('https://discordapp.com/api/oauth2/applications/{}/bot'.format(req.json()['id']),
headers=headers,
json=""
)
if req.status_code != 200:
print('Error :/')
exit(1)
print('Storing application details in {}-bot.json'.format('app_name'))
with open('{}-bot.json'.format('app_name'), 'w+') as f:
f.write(req.text)
print('Bye ! o/')