add proxies on discord requests

master
Aevann1 2022-09-26 04:40:08 +02:00
parent 7e4e98887b
commit 6158cf632a
1 changed files with 7 additions and 7 deletions

View File

@ -25,30 +25,30 @@ def discord_wrap(f):
def add_role(user, role_name): def add_role(user, role_name):
role_id = ROLES[role_name] role_id = ROLES[role_name]
url = f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}/roles/{role_id}" url = f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}/roles/{role_id}"
requests.put(url, headers=headers, timeout=5) requests.put(url, headers=headers, timeout=5, proxies=proxies)
@discord_wrap @discord_wrap
def remove_role(user, role_name): def remove_role(user, role_name):
role_id = ROLES[role_name] role_id = ROLES[role_name]
url = f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}/roles/{role_id}" url = f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}/roles/{role_id}"
requests.delete(url, headers=headers, timeout=5) requests.delete(url, headers=headers, timeout=5, proxies=proxies)
@discord_wrap @discord_wrap
def remove_user(user): def remove_user(user):
url=f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}" url=f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}"
requests.delete(url, headers=headers, timeout=5) requests.delete(url, headers=headers, timeout=5, proxies=proxies)
@discord_wrap @discord_wrap
def set_nick(user, nick): def set_nick(user, nick):
url=f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}" url=f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}"
data={"nick": nick} data={"nick": nick}
requests.patch(url, headers=headers, json=data, timeout=5) requests.patch(url, headers=headers, json=data, timeout=5, proxies=proxies)
def send_changelog_message(message): def send_changelog_message(message):
data={"content": message} data={"content": message}
requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5) requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5, proxies=proxies)
requests.post("https://discordapp.com/api/channels/1013992002624426015/messages", headers=headers, data=data, timeout=5) requests.post("https://discordapp.com/api/channels/1013992002624426015/messages", headers=headers, data=data, timeout=5, proxies=proxies)
def send_wpd_message(message): def send_wpd_message(message):
data={"content": message} data={"content": message}
requests.post("https://discordapp.com/api/channels/1013990963846332456/messages", headers=headers, data=data, timeout=5) requests.post("https://discordapp.com/api/channels/1013990963846332456/messages", headers=headers, data=data, timeout=5, proxies=proxies)