From 6158cf632ac3347ed3015828fd66a841f885ba68 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 26 Sep 2022 04:40:08 +0200 Subject: [PATCH] add proxies on discord requests --- files/helpers/discord.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/files/helpers/discord.py b/files/helpers/discord.py index 9068f4884..4c637f2be 100644 --- a/files/helpers/discord.py +++ b/files/helpers/discord.py @@ -25,30 +25,30 @@ def discord_wrap(f): def add_role(user, role_name): role_id = ROLES[role_name] 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 def remove_role(user, role_name): role_id = ROLES[role_name] 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 def remove_user(user): 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 def set_nick(user, nick): url=f"https://discordapp.com/api/guilds/{DISCORD_SERVER_ID}/members/{user.discord_id}" 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): 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/1013992002624426015/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, proxies=proxies) def send_wpd_message(message): data={"content": message} - requests.post("https://discordapp.com/api/channels/1013990963846332456/messages", headers=headers, data=data, timeout=5) \ No newline at end of file + requests.post("https://discordapp.com/api/channels/1013990963846332456/messages", headers=headers, data=data, timeout=5, proxies=proxies) \ No newline at end of file