update
This commit is contained in:
59
elhf.py
59
elhf.py
@@ -1,10 +1,10 @@
|
||||
import requests
|
||||
|
||||
import json
|
||||
|
||||
def add_command(payload, version="8", app_id="172146408801959936", auth="Bot MTcyMTQ3NTcyMjY4NDY2MTc3.VxbS6w.cAmL2HkGmy58vS-nUdrL2w3Hcto"):
|
||||
|
||||
url = f"https://discord.com/api/v${version}/applications/${app_id}/commands"
|
||||
|
||||
url = f"https://discord.com/api/v{version}/applications/{app_id}/commands"
|
||||
print(url)
|
||||
# For authorization, you can use either your bot token
|
||||
headers = {
|
||||
"Authorization": auth
|
||||
@@ -15,11 +15,58 @@ def add_command(payload, version="8", app_id="172146408801959936", auth="Bot MTc
|
||||
|
||||
|
||||
def delete_command(command_id, version="8", app_id="172146408801959936", auth="Bot MTcyMTQ3NTcyMjY4NDY2MTc3.VxbS6w.cAmL2HkGmy58vS-nUdrL2w3Hcto"):
|
||||
url = f"https://discord.com/api/v${version}/applications/${app_id}/commands/${command_id}"
|
||||
url = f"https://discord.com/api/v{version}/applications/{app_id}/commands/{command_id}"
|
||||
# For authorization, you can use either your bot token
|
||||
headers = {
|
||||
"Authorization": auth
|
||||
}
|
||||
|
||||
r = requests.post(url, headers=headers)
|
||||
print(r.content)
|
||||
r = requests.delete(url, headers=headers)
|
||||
print(r.content)
|
||||
|
||||
def update_command(command_id, payload, version="8", app_id="172146408801959936", auth="Bot MTcyMTQ3NTcyMjY4NDY2MTc3.VxbS6w.cAmL2HkGmy58vS-nUdrL2w3Hcto"):
|
||||
url = f"https://discord.com/api/v{version}/applications/{app_id}/commands/{command_id}"
|
||||
# For authorization, you can use either your bot token
|
||||
headers = {
|
||||
"Authorization": auth
|
||||
}
|
||||
|
||||
r = requests.patch(url, headers=headers, json=payload)
|
||||
print(r.content)
|
||||
|
||||
def get_commands(version="8", app_id="172146408801959936", auth="Bot MTcyMTQ3NTcyMjY4NDY2MTc3.VxbS6w.cAmL2HkGmy58vS-nUdrL2w3Hcto"):
|
||||
url = f"https://discord.com/api/v{version}/applications/{app_id}/commands"
|
||||
# For authorization, you can use either your bot token
|
||||
headers = {
|
||||
"Authorization": auth
|
||||
}
|
||||
|
||||
r = requests.get(url, headers=headers)
|
||||
#print(r.content)
|
||||
resp = r.content.decode("utf-8")
|
||||
return json.loads(resp)
|
||||
|
||||
command_dict = {
|
||||
"name": "roll",
|
||||
"description": "roll a dice",
|
||||
"options": [
|
||||
{
|
||||
"name": "dice",
|
||||
"description": "The number of dice to roll use , for multiple groups of dice ex: 2,5,10",
|
||||
"type": 3,
|
||||
"required": False
|
||||
},
|
||||
{
|
||||
"name": "sides",
|
||||
"description": "How many sides the dice have use , for multiple dice 6,20,4",
|
||||
"type": 3,
|
||||
"required": False
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
#add_command(json)
|
||||
commands = get_commands()
|
||||
print(commands)
|
||||
#command_id = commands[0]["id"]
|
||||
#(command_id=command_id, payload=command_dict)
|
||||
Reference in New Issue
Block a user