A Discord bot for Magic: The Gathering card lookup, with an OpenAI-backed question command attached. Built to run on a free always-on host, so it ships a tiny Flask keep-alive server for uptime pingers to hit.
| Command | What it does |
|---|---|
!ping |
Health check. Replies Pong! |
!card <name> |
Fuzzy-matches a card through the Scryfall API and posts its name and image |
!ask <prompt> |
Sends the prompt to OpenAI and returns the reply, truncated to Discord's 2000-character limit |
python -m venv venv && source venv/bin/activate
pip install discord.py requests openai flask python-dotenvCreate a .env file (gitignored):
DISCORD_BOT_TOKEN=your_bot_token
OPENAI_API_KEY=your_openai_keyThen:
python bot.pyThe bot needs the Message Content privileged intent enabled in the Discord developer portal, since it reads command text from messages.
keep_alive() starts a Flask server on port 8080 that returns I'm alive!. Point
an uptime pinger at it to stop a free-tier host from idling the process out. Drop
it if you are running somewhere that stays up on its own.