-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsniper.py
49 lines (39 loc) · 1.45 KB
/
sniper.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
import requests
import time
vanity_code = 'VANITY HERE'
server_id = 'SERVER ID HERE'
token = 'YOUR TOKEN HERE'
base_url = 'https://discord.com/api/v9'
invite_url = f'{base_url}/invites/{vanity_code}'
settings_url = f'{base_url}/guilds/{server_id}/vanity-url'
headers = {
'Authorization': f'{token}',
'Content-Type': 'application/json',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
}
while True:
try:
response = requests.get(invite_url)
if response.status_code == 404:
print(f'The vanity URL "{vanity_code}" is available.')
time.sleep(1)
patch_response = requests.patch(
settings_url,
headers=headers,
json={'code': vanity_code}
)
if patch_response.status_code == 200:
print(f'Vanity URL "{vanity_code}" has been set for the server.')
break
else:
print(f'Failed to set vanity URL: {patch_response.text}')
time.sleep(60)
elif response.status_code == 200:
print(f'The vanity URL "{vanity_code}" is not available.')
time.sleep(1)
else:
print(f'Unexpected status code: {response.status_code}')
time.sleep(60)
except requests.RequestException as e:
print(f'Error occurred: {e}')
time.sleep(60)