I am new to python, and I was trying to make a python selfbot that messages all my friends, but it keeps throwing up errors even when I try to fix it.
My code is
import discord
import os
import requests
token = input("Enter token: ")
head = {'Authorization': str(token)}
src = requests.get('https://discordapp.com/api/v6/users/@me', headers=head)
if src.status_code == 401:
print("Invalid token.")
exit()
elif src.status_code == 200:
print("Token accepted.")
else:
print("Internal error.")
input()
exit()
T = input("Enter message: ")
if T == "text":
exit(0)
intents = discord.Intents.default()
client = discord.Client(intents=intents)
@client.event
async def on_connect():
for user in client.user.friends:
try:
await user.send(T)
print("Sent message:", user.name)
except:
print("Failed to send message:", user.name)
client.run(token)
Selfbots are against discords terms of service and even if it wasnt you would get rate limited for spamming the api.