generated from nhcarrigan/template
4fdb5d06f1
- Port 19 cohort scripts from /home/naomi/docs/cohort/ - Replace all hardcoded tokens and dotenv usage with os.environ - Add pandas==3.0.1 dependency - Add E501 to ruff ignore list for Discord message string content - Make remove_resigned_members.py reusable (empty RESIGNED_IDS constant) - Make update_roster_messages.py reusable (iterates all teams from JSON) - Exclude 12 one-off/event-specific scripts as non-reusable
34 lines
804 B
Python
34 lines
804 B
Python
#!/usr/bin/env python3
|
|
"""Fetch pinned messages from Ivory Orchid channel to find the roster."""
|
|
|
|
import asyncio
|
|
import json
|
|
import os
|
|
|
|
import aiohttp
|
|
|
|
DISCORD_BOT_TOKEN = os.environ["DISCORD_BOT_TOKEN"]
|
|
CHANNEL_ID = "1464316770889240730"
|
|
|
|
|
|
async def main() -> None:
|
|
"""Fetch and print pinned messages from the Ivory Orchid channel."""
|
|
headers = {
|
|
"Authorization": f"Bot {DISCORD_BOT_TOKEN}",
|
|
"Content-Type": "application/json",
|
|
}
|
|
|
|
async with (
|
|
aiohttp.ClientSession() as session,
|
|
session.get(
|
|
f"https://discord.com/api/v10/channels/{CHANNEL_ID}/pins",
|
|
headers=headers,
|
|
) as response,
|
|
):
|
|
pins = await response.json()
|
|
print(json.dumps(pins, indent=2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|