Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (40 loc) · 1.52 KB
/
Copy pathmain.py
File metadata and controls
47 lines (40 loc) · 1.52 KB
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
import requests
from colorama import Back, Fore, Style, init
import datetime
import time
import sys
init()
def changeNickname(token, guild_id, delay, name):
url = f'https://discord.com/api/v9/guilds/{guild_id}/members/@me' # 487226897487364097 <- Qual
headers = {'Authorization': f'{token}'}
while True:
time_ = datetime.datetime.now().strftime("%H:%M")
data = {
"nick": f"[{time_}] {name}"
}
r = requests.patch(url, headers=headers, json=data)
r_name = requests.get(url, headers=headers)
if r.status_code == 200:
print(f'{Fore.GREEN} Change nickname - {r.status_code}\n\t{data}\n')
else:
print(f'{Fore.RED} Change nickname - {r.status_code}\n{r.text}\n')
time.sleep(delay)
if __name__ == '__main__':
TOKEN = open("token.txt", 'r').read()
if len(TOKEN) < 2:
TOKEN = input("Enter account token: ")
guild = open("guild.txt", 'r').read()
if len(guild) < 2:
guild = input("Enter guild id: ")
delay = int(input("Enter delay (seconds) between nick change: "))
# if delay < 30:
# sys.exit("Delay must be greater than 30 seconds")
name = input("Enter name (optional): ")
if name == '':
g_url = f'https://discord.com/api/v9/users/@me'
headers = {'Authorization': f'{TOKEN}'}
r_name = requests.get(g_url, headers=headers)
name = r_name.json()["username"]
changeNickname(TOKEN, guild, delay, name)
else:
changeNickname(TOKEN, guild, delay, name)