#!/usr/bin/env python3 """Check if removed members are still in the Discord server.""" import asyncio import os import aiohttp DISCORD_BOT_TOKEN = os.environ["DISCORD_BOT_TOKEN"] BASE_URL = "https://discord.com/api/v10" GUILD_ID = "1354624415861833870" SAMPLE_MEMBERS = [ "899092786802987069", "1318882254365397032", "799293680799711273", "237793557992308736", ] async def check_member(session: aiohttp.ClientSession, user_id: str) -> bool | None: """Check if a member is in the server.""" url = f"{BASE_URL}/guilds/{GUILD_ID}/members/{user_id}" headers = {"Authorization": f"Bot {DISCORD_BOT_TOKEN}"} async with session.get(url, headers=headers) as resp: if resp.status == 200: data = await resp.json() roles = data.get("roles", []) print(f"✅ User {user_id} IS in server - has {len(roles)} roles: {roles}") return True if resp.status == 404: print(f"❌ User {user_id} NOT in server (left or was kicked)") return False error = await resp.text() print(f"⚠️ Error checking {user_id}: {resp.status} - {error}") return None async def main() -> None: """Check if sample members are still in the server.""" async with aiohttp.ClientSession() as session: for user_id in SAMPLE_MEMBERS: await check_member(session, user_id) await asyncio.sleep(1) if __name__ == "__main__": asyncio.run(main())