Update command_creator.py
This commit is contained in:
parent
3d88006277
commit
a51cecb00f
@ -2,24 +2,28 @@
|
|||||||
Slash command creator for the discord.py The Guardians Bot.
|
Slash command creator for the discord.py The Guardians Bot.
|
||||||
© by ElBe.
|
© by ElBe.
|
||||||
|
|
||||||
Version: 0.1.0
|
Version: 0.1.3
|
||||||
'''
|
'''
|
||||||
|
|
||||||
#Imports
|
#Imports
|
||||||
import requests
|
import requests
|
||||||
|
import functions
|
||||||
|
|
||||||
#Variables
|
#Variables
|
||||||
url = "https://discord.com/api/v10/applications/<INSERT APPLICATION ID HERE>/commands"
|
url = 'https://discord.com/api/v10/applications/' + functions.json_module.get_config('Config')['Application ID'] + '/commands'
|
||||||
json = {
|
|
||||||
"name": "<COMMAND NAME>",
|
|
||||||
"type": 1,
|
|
||||||
"description": "<COMMAND DESCRIPTION>"
|
|
||||||
}
|
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": "Bot <INSERT TOKEN HERE>"
|
'Authorization': 'Bot ' + functions.json_module.get_config('Config')['Token']
|
||||||
}
|
}
|
||||||
|
|
||||||
#Request
|
#Example Command
|
||||||
|
json = {
|
||||||
|
'name': 'ping',
|
||||||
|
'type': 1,
|
||||||
|
'description': 'Shows you the ping of the bot.'
|
||||||
|
}
|
||||||
|
|
||||||
|
#Function
|
||||||
|
def create_command(json):
|
||||||
try:
|
try:
|
||||||
r = requests.post(url, headers=headers, json=json)
|
r = requests.post(url, headers=headers, json=json)
|
||||||
print('Command /' + str(json['name']) + ' was sucessfully created.')
|
print('Command /' + str(json['name']) + ' was sucessfully created.')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user