The idea for this project arose when I noticed a common cross-community necessity. While using Discord to engage with extracurricular groups, classes, friends and gaming communities, I noticed that admins were often manually moving people from channel to channel for a variety of reasons. Another commonly used communication software, called Teamspeak, has the ability to easily move all of users from one channel to another. So I thought, why not add that feature to Discord? And why not make it even better?
For this project, I decided to use a Python wrapper of the Discord API to be able to utilize Python’s fast and simple development potential. Furthermore, I planned to port the project to C++, if I ran into performance issues. I planned for this project to be divived into three main stages, each of which adhering to SDLC principles:
The goal of the first stage was to create a simple text-based command that would move all users from one channel to another channel. After analyzing the documentation found here, it was easier than expected to implement a function to move all users from one channel to another.
The goal of the next stage was to implement commands for the following key features: Move users from channel to channel given specific roles, move all active users in the server to one channel, move users based on activity in the activity bar (i.e. playing game X, or listening to artist Y on Spotify). While working in the testing phase of this stage, I found that it started to feel redundant typing the commands over and over again, and wondered if there was a way to make mass moving users even more simple. Eventually, I came up with the idea to use Discord’s reaction system to mass move users. The idea was to have the bot populate a dedicated text channel with a message for each of the names of all voice channels in the server, and use reactions to evoke a mass move. In this way, it only takes two clicks to perform a mass move! One click to choose the channel you wish to move users from, and one click to choose the channel you wish to move users to.
Up until this point the entire application was designed, developed, and tested on-prem. The final stage consisted of moving the entire application to a dedicated host in order for it to run 24/7. After some research I found Heroku, a cloud application platform, which would allow me to run the entire app 24/7 for free! Integrating over to Heroku was by no means easy, but after I had learned the nuances of the systems and overcome some small technical hurdles, I had an up and running, fully functional, mass move Discord bot!
I learned how to use Python’s asynchronous features from the Asyncio library . Using these features allowed me to get more hands on experience in implementing things such as coroutines and concurrency which help increase throughput of IO bound applications and systems.
While working with Heroku, I learned how to develop on their cloud platform and a bit about the other services that they provide. I made one huge mistake which was leaking my personal Discord Developer API key. Through this mistake I learned the importance of storing necessary API keys or sensitive information in the environment of your app to prevent leaking said information.
Copyright © All rights reserved | Colorlib