import requests
# Replace with your actual bot token, guild ID, and role ID
BOT_TOKEN = 'YOUR_BOT_TOKEN'
GUILD_ID = 'YOUR_GUILD_ID'
ROLE_ID = 'YOUR_ROLE_ID'
# Discord API endpoint for modifying a role
url = f'https://discord.com/api/v9/guilds/{GUILD_ID}/roles/{ROLE_ID}'
# Headers for authentication
headers = {
'Authorization': f'Bot {BOT_TOKEN}',
'Content-Type': 'application/json'
}
# Data for updating the role
data = {
'name': 'New Role Name', # New name for the role
'permissions': 'permissions_integer_value', # Permissions integer (optional)
'color': 0x1ABC9C, # New color for the role (optional)
'hoist': True, # Whether the role should be displayed separately in the sidebar (optional)
'mentionable': True # Whether the role should be mentionable (optional)
}
# Make the PATCH request to update the role
response = requests.patch(url, headers=headers, json=data)
# Check if the request was successful
if response.status_code == 200:
print('Role updated successfully.')
else:
print(f'Failed to update role: {response.status_code}')
print(response.json())
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}