diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-04-22 01:23:18 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-04-22 01:23:18 -0700 |
| commit | 371ce5aba3ba8be9e00f93d3a4d36abff3e5e180 (patch) | |
| tree | 6bb3b1503b2b6a6b32d63837e67eba3ea28846f2 /community/disc.py | |
| parent | d88ea267b780aebc077b43dcf56a0141c3abe6d4 (diff) | |
add wac_plus community
Diffstat (limited to 'community/disc.py')
| -rw-r--r-- | community/disc.py | 28 |
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}") |
