aboutsummaryrefslogtreecommitdiffstats
path: root/community/disc.py
diff options
context:
space:
mode:
Diffstat (limited to 'community/disc.py')
-rw-r--r--community/disc.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/community/disc.py b/community/disc.py
new file mode 100644
index 0000000..8cc5aeb
--- /dev/null
+++ b/community/disc.py
@@ -0,0 +1,28 @@
+import os
+import requests
+from dotenv import load_dotenv
+
+load_dotenv()
+
+def fetch_messages(channel_id: str):
+ url = f"https://discord.com/api/v9/channels/{channel_id}/messages?limit=50"
+ headers = {
+ "accept-encoding": "gzip, deflate, br, zstd",
+ "accept-language": "en-GB",
+ "authorization": os.getenv("DISCORD_AUTHORIZATION"), # Replace with your real token
+ "priority": "u=1, i",
+ "sec-ch-ua": '"Not:A-Brand";v="24", "Chromium";v="134"',
+ "sec-ch-ua-mobile": "?0",
+ "sec-ch-ua-platform": '"Linux"',
+ "sec-fetch-dest": "empty",
+ "sec-fetch-mode": "cors",
+ "sec-fetch-site": "same-origin",
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
+ "x-debug-options": "bugReporterEnabled",
+ "x-discord-locale": "en-US",
+ "x-discord-timezone": "America/Vancouver",
+ }
+ response = requests.get(url, headers=headers)
+ return response.json()
+ if response.ok:
+ print(f"Failed to fetch: {response.status_code} - {response.text}")
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage