Discord Bot Update - Basic Bot Filtering

Post Thumbnail

After being busy with a lot of other side work, and the whole craziness going on with the current pandemic, I have finally gotten some time to work on my Discord Bot. The whole point of this bot is to use an Event based architecture to build out a workable, usable bot. And if I can sneak a bit of machine learning, cloud monitoring, ARM templates, session management and any other interesting thing I can justify playing with :-).

Project Page

One of the first things I have done recently is clean up the project page and start structuring the changes I do a little better. It also helps me keep track of the current changes and the planned changes for each release. The other change I am trying is to keep a monthly change cycle, so that at the end of each month I will wrap those changes and move to the next cycle. By design, it generates a nice feature list of all the things I’ve managed to learn and implement as well.

Update - Basic Filtering

The goal of this first update was to implement basic profanity filtering. I already have most of the plumbing for the bot hooked up in that events are all being captured and the messages are being relayed from the Discord proxy service through an Event Grid hooked up to Azure Functions. Implementing a profanity filter starts with adding a new web hook into this message Event Grid. An Azure Function captures each message and runs a simple RegEx to match individual words against a list of known profane words.

If the RegEx matches it filters the bad words with and sends the edited phrase back to the Discord proxy with a filter command. The Discord proxy then removes the message and the bot generates a replacement message. This whole processes is pretty simple, but effective enough for most use cases. It’s quite easy to get around, and generally only works against idle profanity. It is also, at the moment, hard coded into a simple string list. However, with this function and the command !ping function hooked up, it can be iterated upon to solve a number of problems.

Next Steps

The next change for the bot will be to read the list from a CosmosDB and, if possible, link it to the Guild ID so that individual servers can maintain their own filtering list. This gives me a chance to hook up and play with CosmosDB, a very efficient way to read data from a server.

comments powered by Disqus
About Me

Hi, I'm Glenn!

As the Director of IT Operations, I am responsible for leading a team of IT professionals across both IT support and IT operations. I am an experienced, pragmatic IT professional that has helped organizations with transformational projects. I have a diverse experience across development and infrastructure, I am passionate about learning new technologies and solving complex problems. I also occasionally develop web applications and write.

About Me