Created
May 20, 2022 23:35
-
-
Save Heliodex/38a89e4a05803f7b15d0a55abfe5428d to your computer and use it in GitHub Desktop.
Ping a discord webhook to notify of the online status of a Roblox user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Heliodex 2022/05/20 | |
# Last edited 2022/05/20 | |
# Checks every minute to see if a Roblox user is online, and pings a discord webhook if that status has changed. | |
import requests | |
import json | |
from time import sleep | |
from dateutil import parser | |
while True: | |
responseText = json.loads(requests.get( | |
"https://api.roblox.com/users/303400323/onlinestatus/").text) | |
textToSend = "" | |
online = responseText["IsOnline"] | |
previouslyOnline = False | |
if responseText["IsOnline"] == True: | |
textToSend = "https://www.roblox.com/users/303400323/profile IS ONLINE" | |
else: | |
lastOnline = str(parser.parse(responseText["LastOnline"]))[0:19] | |
# 2022-05-20 05:51:42 | |
textToSend = f"https://www.roblox.com/users/303400323/profile Last online {lastOnline}." | |
print(textToSend) | |
if previouslyOnline != online: # only if it is different to last time | |
print(previouslyOnline) | |
print(online) | |
requests.post("*", data={"content": textToSend}) | |
previouslyOnline = online | |
sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just remembered this
it was made in 25 minutes to beat @Mantaraix imagine using 3 days in c# to build the same thing but that actuall y works well