From 67e12cf89bf983760b218170cde2d14021b464eb Mon Sep 17 00:00:00 2001 From: whitenoised <40986616+whitenoised@users.noreply.github.com> Date: Thu, 11 Jan 2024 18:07:15 +0400 Subject: [PATCH] Update bot.py Minor updates to make code works properly --- discord_bot/bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/discord_bot/bot.py b/discord_bot/bot.py index 104238b..0b385b8 100644 --- a/discord_bot/bot.py +++ b/discord_bot/bot.py @@ -68,19 +68,19 @@ "content-type": "application/json", "user-agent": text[0], "authorization": text[1], - "host": "discordapp.com", + "host": "discord.com", "referrer": text[2] } print("Messages will be sent to " + header_data["referrer"] + ".") def get_connection(): - return HTTPSConnection("discordapp.com", 443) + return HTTPSConnection("discord.com", 443) def send_message(conn, channel_id, message_data): try: - conn.request("POST", f"/api/v6/channels/{channel_id}/messages", message_data, header_data) + conn.request("POST", f"/api/v9/channels/{channel_id}/messages", message_data, header_data) resp = conn.getresponse() if 199 < resp.status < 300: @@ -107,7 +107,7 @@ def main(msg): if __name__ == '__main__': - print("Message to send- when finished, type an EOF character:") + print("Message to send- when finished, type an EOF character (use ctrl+z):") message = sys.stdin.read() messages = int(input("Amount of messages: ")) main_wait = int(input("Seconds between messages: "))