{"id":520,"date":"2019-09-16T12:00:50","date_gmt":"2019-09-16T19:00:50","guid":{"rendered":"http:\/\/letsbuildroboticswithshadow8472.com\/?p=520"},"modified":"2019-09-16T02:49:21","modified_gmt":"2019-09-16T09:49:21","slug":"programming-a-discord-bot-part-3-of-4-for-sure","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2019\/09\/16\/programming-a-discord-bot-part-3-of-4-for-sure\/","title":{"rendered":"Programming a Discord Bot Part 3 (of 4 for sure)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow 8472, and today, I am excited because I recently got a working prototype on my &#8220;preemptive&#8221; ban bot. Let&#8217;s get started!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, I won&#8217;t claim to understand most of the stuff I&#8217;m working with, just that it isn&#8217;t as closely related to security as my last side project. If someone working all day every day could have done this project as easily as walking through a room, I would be crawling through a hole just barely my size. I&#8217;ve had a lot of help drilling that tunnel, and now widening it looks like it will be a whole lot faster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A lot of what I did was trying to understand how Discord thinks, not quite fully getting it, getting help, and only understanding it until I needed another reminder. The long story is that I couldn&#8217;t repeat most of the details from memory. Guess what I&#8217;m basically doing right now.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve been using PyCharm on my laptop as my IDE. On one of my previous trips to the workshop, Headcrash showed me how to use the debugger, but the neuances didn&#8217;t really stick. Before I went in this week, Damaged, the person who&#8217;s been helping me over Discord, helped me get through multiple hurdles, some of which should be obvious, others not so much. I was working up until right before sundown Friday, when I stopped for Sabbath.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next night, I spent not two minutes before bed so I&#8217;d actually work on it in the morning, and got the early prototype working: I had someone on my a ban list who had never even been invited. Of course, I made a backup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next phase involved disarming the ban function&#8217;s &#8220;warhead&#8221; with a long comment and having it pull the target&#8217;s ID from the audit log. The function to loop over the audit log is even pretty user friendly at first glance. It was at this time I reached for a tool I wasn&#8217;t familiar with: the debugger.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A debugger is no doubt a valuable tool to know once you know how to use it. I came to a point where I had been introduced to it, but when I tried to use it, I tripped up on a small detail and took it in to the workshop. No sooner had I recreated my error and started explaining my problem than I poked around a little and figured out the answer on my own; the debugger has its own tab. I still learned a lot about how exactly this debugger works and how its interface is different than the ones I played with in the past.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At present, I have an untested\/unproven candidate for my final bot before setting it loose on the real server. Right now, it can be told a bad mod&#8217;s ID and target logged unban events made by that account. When I&#8217;m done, I plan on having it tell me the names and numbers of all the people who were maliciously kicked. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Final Question: The filter for the audit log was not as user friendly as I had hopped., but not as bad as I feared (with the power of the debugger to view all active variable names and values at key points in the program). Have you ever come across a problem where the solution was on the path to that problem?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow 8472, and today, I am excited because I recently got a working prototype on my &#8220;preemptive&#8221; ban bot. Let&#8217;s get started! First of all, I won&#8217;t claim to understand most of the stuff I&#8217;m working with, just that it isn&#8217;t as closely related to security as &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2019\/09\/16\/programming-a-discord-bot-part-3-of-4-for-sure\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Programming a Discord Bot Part 3 (of 4 for sure)&#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":[9],"tags":[],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/520","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=520"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":521,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/520\/revisions\/521"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}