{"id":513,"date":"2019-08-26T12:00:13","date_gmt":"2019-08-26T19:00:13","guid":{"rendered":"http:\/\/letsbuildroboticswithshadow8472.com\/?p=513"},"modified":"2019-08-26T01:30:14","modified_gmt":"2019-08-26T08:30:14","slug":"programming-a-pi-with-a-discord-bot-part-1-of-1-hopefully","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2019\/08\/26\/programming-a-pi-with-a-discord-bot-part-1-of-1-hopefully\/","title":{"rendered":"Programming a Pi With a Discord Bot Part 1 (of 1 hopefully)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow_8472, and today, I&#8217;m inching back into actual programming with the skills I&#8217;ve built up with SSH over the past month paving the way with a bit smoother workflow. Let&#8217;s get started!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few weeks back, I was made an admin on a Discord server after an unsavory character I shall only refer to as Z nuked it majorly. He took advantage of the owner&#8217;s weakened state after constant raids, unbanned pretty much everyone, and kicked about two thirds of the total population. Z&#8217;s rampage went on for around 10 minutes, but he caused massive damage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As an admin, I&#8217;m helping rebuild the server. One of the tasks is rebanning everyone Z unbanned. Oops. Discord only gives you the option to ban someone if they have some sort of presence on the server by way of being a member or having a message. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When Discord bans someone, it offers to permanently delete a few days of messages from them. Troll tactics often involve getting a bunch of alt accounts on at a time for wide-spread harassment. When the server staff is doing a good job, alt accounts get banned quickly, and all traces of them are incidentally removed from the server. Bad news for me when trying to reban.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The good news is that Discord have a little more access to Discord&#8217;s full feature set, and one of those tools is banning accounts without needing a membership or a post. However, with a new goal in a slightly unfamiliar field, that implies new learning to be had.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first step was defining what exactly I want it to do: Reban the unreachable. Next, I settled on hard coding each name that still needed banning. I&#8217;ve had issues with bot stability when running someone else&#8217;s dice bot myself, but I don&#8217;t need to worry since the finished bot need only run once and it&#8217;s done, ready to archive.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The hardest part would have been getting Python3 on. Lucky me, I have the earliest version of Python supported by Discord&#8217;s Python wrapper already installed on Blinkie from my naughty kitty project. I just had to install a few dependencies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I met someone on Discord by the handle of Damaged who I got the majority of my assistance from. They actually pointed me in the direction of programming my own bot instead of just trusting someone else&#8217;s. &#8220;What I can say is that you need to be very careful of any bot you want to get to [ban people]. You&#8217;re effectively going to give them the keys to the castle.&#8221; Security is of concern. I once hacked a new bot (with permission from an admin) into pinging everyone when a normal account doesn&#8217;t let you do that. The last thing I want to do is let possible trolls have devastating tools I left laying around.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Banning doesn&#8217;t sound like anything too fancy to program, and the skills and tools I develop for this project should be useful later. I learned how Discord bots log into bot accounts with some kind of token. I learned how to tell the bot to print its account ID to the command line and use that to add its account to a server. As of the writing of this post, I have gotten a sample bot debugged and running and responding to a simple command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next step was a little revision in plans. I have about 50 names to reban or so in total, and bots can theoretically easily do the deed quickly and more thoroughly than I can. I figured it was likely somewhere around a wash, so I&#8217;m going to program a bot to look for all Z&#8217;s unbans and reban them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other possible bot features I might like are the ability to nuke someone&#8217;s entire history with the server. Another person who left now has a crude name I wouldn&#8217;t mind if it were gone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Final Question: Not all bots need potentially dangerous permissions to run. What are some niche moderation bots you&#8217;ve seen\/used?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today, I&#8217;m inching back into actual programming with the skills I&#8217;ve built up with SSH over the past month paving the way with a bit smoother workflow. Let&#8217;s get started! A few weeks back, I was made an admin on a Discord server after an &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2019\/08\/26\/programming-a-pi-with-a-discord-bot-part-1-of-1-hopefully\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Programming a Pi With a Discord Bot Part 1 (of 1 hopefully)&#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":[1],"tags":[],"class_list":["post-513","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/513","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=513"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/513\/revisions"}],"predecessor-version":[{"id":514,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/513\/revisions\/514"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}