Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1542

How do i send discord slash commands with python?

$
0
0

How do i make it send a slash command with a user token? (NOT A BOT TOKEN)

I have already tried recording what happens when i send a slash command and the thing is when i put everything in python it just gives me the status code 204 and doesnt do anything.This is my code:`import requestsimport json

url = "https://discord.com/api/v9/interactions"

payload = {"type": 2,"application_id": "hidden","guild_id": "hidden","channel_id": "hidden","session_id": "hidden","data": {"version": "hidden","id": "hidden","guild_id": "hidden","name": "test","type": 1,"options": [],"application_command": {"id": "hidden","type": 1,"application_id": "hidden","guild_id": "hidden","version": "hidden","name": "test","description": "test1","integration_types": [0],"options": [],"description_localized": "test1","name_localized": "test"},"attachments": []},"nonce": "hidden","analytics_location": "slash_ui"}

json_payload = json.dumps(payload)

headers = {"Authorization": "hidden","Content-Type": "application/json"}

response = requests.post(url, data=json_payload, headers=headers)

if response.status_code == 200:print("done")else:print(f"error: {response.status_code}")`


Viewing all articles
Browse latest Browse all 1542

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>