Skip to content

Instantly share code, notes, and snippets.

@a3r0id
Last active May 19, 2024 05:49
Show Gist options
  • Save a3r0id/a3bb20db999d85ed4dc1052528048ef7 to your computer and use it in GitHub Desktop.
Save a3r0id/a3bb20db999d85ed4dc1052528048ef7 to your computer and use it in GitHub Desktop.
Discord Stuff...
from requests import get, post
class data:
token = "YOUR_TOKEN"
host = "https://discord.com"
headers = {
"Authorization": token,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
}
# [i] Using this after user has already accepted/denied a friend-request will result in an unverified account getting phone verification wall.
# [i] You can use a GET request first to check if the user is already your friend to avoid the issue above.
def friend_request(fullUsername):
user = fullUsername.split("#")[0]
discriminator = fullUsername.split("#")[1]
r = post(data.host + "/api/v8/users/@me/relationships", headers=data.headers, json={
"username": user,
"discriminator": int(discriminator)
})
return {"status": r.status_code, "response": r.content}
def join_server(invite):
endpoint = data.host + f"/api/v8/invites/{invite}?inputValue=https%3A%2F%2Fdiscord.gg%2{invite}&with_counts=true"
r = get(endpoint, headers = data.headers)
if r.status == 200:
p = post(data.host + f"/api/v8/invites/{invite}", headers = data.headers)
return {"status": p.status_code, "response": p.content}
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment