-
Notifications
You must be signed in to change notification settings - Fork 1
/
statuscopier.py
110 lines (104 loc) · 3.59 KB
/
statuscopier.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import discord, json ,time, requests
from discord.ext import commands,tasks
f = open( "UserToken&IDs.txt" ,"r")
statuschange_url = "https://discord.com/api/v9/users/@me/settings"
token = str(f.readline().strip())
user_id = int (f.readline().strip()) #test/sample id = 962488616058245140
sharedguild_id = int (f.readline().strip()) #test/sample id = 962491841293467650
f.close()
f2 = open("oldstatus.txt","r")
oldstatus = f2.readline().strip()
offline = False
intents = discord.Intents.all()
intents.members = True
intents.guilds = True
bot = commands.Bot(command_prefix='>', self_bot=True, intents=intents) #random command prefix
def formattedPrint(str):
print("------------------------------------------------------------------------------------")
print(str)
print("------------------------------------------------------------------------------------")
def getFormattedTime():
return time.strftime('%I:%M:%S %p %Z on %b %d, %Y')
def changeStatusOffline():
payload = {
"status": "invisible",
}
headers = {
"authorization": token,
"content-type": "application/json"
}
r = requests.patch(statuschange_url, data=json.dumps(payload), headers=headers)
if (r.status_code == 200): #success
formattedPrint("Succesfully went invisible " + "\nAt " + getFormattedTime())
updateOldStatus("NO STATUS: (invisible)")
else: #400
formattedPrint("Error in going invisible..." + getFormattedTime())
def updateOldStatus(status):
global oldstatus
oldstatus = status
f3 = open("oldstatus.txt","w")
f3.write(status)
f3.close()
def changeStatus(message,str_status):
payload = {
"status": str_status,
"custom_status": {
"text": message,
}
}
headers = {
"authorization": token,
"content-type": "application/json"
}
r = requests.patch(statuschange_url, data=json.dumps(payload), headers=headers)
if (r.status_code == 200): #success
formattedPrint("Succesfully changed status to\n\"" + message + "\"\nwhilst on " + str_status + " mode \nAt " + getFormattedTime())
updateOldStatus(message)
else: #400
formattedPrint("Error in changing status... at " + getFormattedTime())
def changeAboutMe(message):
payload = {
"bio": message
}
headers = {
"authorization": token,
"content-type": "application/json"
}
r = requests.patch(statuschange_url, data=json.dumps(payload), headers=headers)
if (r.status_code == 200): #success
formattedPrint("Succesfully changed about me to\n\" " + message + " \"\nAt " + getFormattedTime())
else: #400
formattedPrint("Error in changing about me..." + getFormattedTime())
@bot.event
async def on_ready():
formattedPrint("Running on the account: " + bot.user.name)
formattedPrint("WARNING: Self-bots on discord can get you banned" + "\nStarted Bot...")
checkStatus.start()
@tasks.loop(minutes=1)
async def checkStatus():
global oldstatus, offline
guild = bot.get_guild(sharedguild_id)
person = guild.get_member(user_id)
if (str(person.raw_status) != "offline"):
offline = False
activities = person.activities
str_status = person.raw_status
if (len(activities) != 0):
status = str(activities[0])
if (status != oldstatus):
changeStatus(status,str_status)
else:
formattedPrint("Your status matches person's status already | " + getFormattedTime())
else:
status = "Baller"
if (status != oldstatus):
oldstatus = status
changeStatus(status,str_status)
formattedPrint("Person currently has no status | " + getFormattedTime())
else:
#await bot.change_presence(status=discord.Status.offline)
if (not offline):
offline = True
changeStatusOffline()
formattedPrint("Target User Not Online | " + getFormattedTime())
bot.run(token, bot=False)