MarkovBot Dev Diary #1
By: Cam Wohlfeil
Published: 2019-02-08 1440 EST
Category: DevDiary
Tags:
python,
markovbot
Unlike with Shelf, I didn't create a post for this project before I got started. It's been on the backburner for a while now due to time and frustration, but it's been living on in the back of my mind now since I did have fun working on it.
The basic idea here is just a Python bot that reads the messages in a Discord server and can generate a Markov sentence based on the messages. Easy enough since discord.py
and markovify
exist, but I overcomplicated it last time and got frustrated trying to store everything in a database to support server separation and per user Markov sentences, plus discord.py
hadn't finished their support for Python 3.7. At least in the process I learned discord.py
and a lot about async/await.
This time, I've decided to go back to basics, just use a simple deque to collect only new messages. Once that's working I'll move on to adding more features, such as:
- Support multiple servers (store corpus in database or file instead of in memory)
- Support generating markov for specific users (see above)
- Support explicit message count limits (currently hardcoded in deque to 500)
- Unit tests
- Move config to ini at the top level (currently a dict)
- setup.py
- TTS for the big meme
- Better error handling
- Request rate limiting
References