Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

discBot

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.

Commands

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

Setup

python -m venv venv && source venv/bin/activate
pip install discord.py requests openai flask python-dotenv

Create a .env file (gitignored):

DISCORD_BOT_TOKEN=your_bot_token
OPENAI_API_KEY=your_openai_key

Then:

python bot.py

The bot needs the Message Content privileged intent enabled in the Discord developer portal, since it reads command text from messages.

Keep-alive

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.

About

Discord bot for Magic: The Gathering card lookup through the Scryfall API, with OpenAI-backed question answering.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages