-
Notifications
You must be signed in to change notification settings - Fork 79
/
captureIds.py
70 lines (45 loc) · 1.31 KB
/
captureIds.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import discord
import json
try:
with open("ids.json", "r") as file:
data = json.load(file)
except Exception as e:
print(f" [!] {e}")
prompt = input(" [?] Reset ids.json? (y/n): ").strip().lower()
while prompt not in ("y", "n"): # Ignore invalid input
prompt = input(" [?] Reset ids.json? (y/n): ").strip().lower()
if prompt[0] == "y":
with open("ids.json", "w") as file:
data = []
json.dump(data, file)
def log_id(member):
if member.bot: # Skip bots
return
user_id = member.id
if user_id not in data:
data.append(user_id)
with open("ids.json", "w") as file:
json.dump(data, file)
print(f" [+] {user_id} Total: {len(data)}")
client = discord.Client()
token = input(" [?] Enter your token: ")
@client.event
async def on_ready():
print(" [!] Started logging ids\n")
@client.event
async def on_message(message):
log_id(message.author)
@client.event
async def on_raw_reaction_add(payload):
log_id(payload.member)
@client.event
async def on_member_join(member):
log_id(member)
@client.event
async def on_member_update(_, after):
print(after)
log_id(after.member)
@client.event
async def on_voice_state_update(member, _, __):
log_id(member)
client.run(token, bot=False)