I Upgraded My Python Discord Bot (Week3)

Good Morning from my Robotics Lab! This is Shadow_8472 and today, the development cycle continues on my Discord dice bot. Be sure to catch the last two weeks’ posts before reading this one. Let’s get started!

The Development Cycle

My bot will never truly be “done.” In the past, once software was released, it was typically tied to physical media. New features and bug fixes were either integrated into fresh copies or sold as expansion packs. In more recent times, your license to run a piece of proprietary software is tracked by an online service like Steam, and updates are usually free of charge. When you’re developing a piece of software internally, versions mean less and less until some deadline is reached or it’s “good enough” to stop work for a while.

When I stopped work last week, I was not “good enough.” It was pointed out to me that challenge dice for Star Trek Adventures, the game I’ll be playing, count their challenge pips as normal pips as well. My dice engine actually already supported multiple pip types on the same side naively, so I adjusted the challenge die definition instead of bodging a solution.

Various other improvements behind the scenes included matching the double space from the engine file over in the bot’s main file, making the challenge dice roll command use an icon picture, and implementing the RegEx OR operator for screening input. And then I went to adding or subtracting constants. I must have spent an hour or two trying to shove it through the engine side of things. I lost count at four places they needed special handling along the way from parsing to tallying. Just as I was about to finish, I had the brilliant, but tardy idea to code constants as single-sided, single-valued dice. Another good chunk of coding time summed up in one critical line of code. I was sure to leave a comment.

As part of my little constant episode, I made several changes to the code in lots of hard-to-remember places. Fortunately for me, most or all of my unrelated work was on the bot side of things. Because I split the file between bot and dice engine, I was able to pull up an old copy of the engine from the “production” branch and make the relatively few needed changes.

Takeaway

At this point, I need to plan on finishing the month with this bot. The engine’s code is messy, and I’d rather put it away clean so I don’t have to start over or feel the need to black box it next time I need dice.

Final Question

RegEx gave me a bit of trouble working on it. I used https://regex101.com/ to design my expression, but some of the statements they used threw exceptions in Python. Have you ever had a version mismatch give you a bit of grief?

Leave a Reply