Programming a Discord Bot Part 3 (of 4 for sure)

Good Morning from my Robotics Lab! This is Shadow 8472, and today, I am excited because I recently got a working prototype on my “preemptive” ban bot. Let’s get started!

First of all, I won’t claim to understand most of the stuff I’m working with, just that it isn’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’ve had a lot of help drilling that tunnel, and now widening it looks like it will be a whole lot faster.

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’t repeat most of the details from memory. Guess what I’m basically doing right now.

I’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’t really stick. Before I went in this week, Damaged, the person who’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.

The next night, I spent not two minutes before bed so I’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.

The next phase involved disarming the ban function’s “warhead” with a long comment and having it pull the target’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’t familiar with: the debugger.

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.

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’s ID and target logged unban events made by that account. When I’m done, I plan on having it tell me the names and numbers of all the people who were maliciously kicked.

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?

Leave a Reply