{"id":1115,"date":"2022-09-12T12:00:00","date_gmt":"2022-09-12T19:00:00","guid":{"rendered":"https:\/\/letsbuildroboticswithshadow8472.com\/?p=1115"},"modified":"2022-09-12T07:28:12","modified_gmt":"2022-09-12T14:28:12","slug":"i-upgraded-my-python-discord-bot-week3","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2022\/09\/12\/i-upgraded-my-python-discord-bot-week3\/","title":{"rendered":"I Upgraded My Python Discord Bot (Week3)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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\u2019 posts before reading this one. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Development Cycle<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">My bot will never truly be \u201cdone.\u201d 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\u2019re developing a piece of software internally, versions mean less and less until some deadline is reached or it\u2019s \u201cgood enough\u201d to stop work for a while.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When I stopped work last week, I was not \u201cgood enough.\u201d It was pointed out to me that challenge dice for Star Trek Adventures, the game I\u2019ll 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Various other improvements behind the scenes included matching the double space from the engine file over in the bot\u2019s 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 \u201cproduction\u201d branch and make the relatively few needed changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, I need to plan on finishing the month with this bot. The engine\u2019s code is messy, and I\u2019d rather put it away clean so I don\u2019t have to start over or feel the need to black box it next time I need dice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Question<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">RegEx gave me a bit of trouble working on it. I used <a href=\"https:\/\/regex101.com\/\">https:\/\/regex101.com\/<\/a> 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?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019 posts before reading this one. Let\u2019s get started! The Development Cycle My bot will never truly be \u201cdone.\u201d In the past, once software was released, it was &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2022\/09\/12\/i-upgraded-my-python-discord-bot-week3\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;I Upgraded My Python Discord Bot (Week3)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[92],"tags":[],"class_list":["post-1115","post","type-post","status-publish","format-standard","hentry","category-discord-bot"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=1115"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1115\/revisions"}],"predecessor-version":[{"id":1116,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1115\/revisions\/1116"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=1115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=1115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=1115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}