How a missing feature made me a Verified Discord Developer
Tags: octograd2020
Published: 2020-05-20 13:30:54

I've been using Discord for a while. I think back in 2017 or so one of my friends told me about this funky new app and said he was leaving skype behind so if I wanted to keep chatting I'd have to move over. I was pretty hesitant back then but I ended up doing it and it was one of the best decisions I'd made in a while. Discord is awesome. The server system makes communities easy and it has enough flexibility to do almost anything, especially with bots.

Now, I say almost and that's because some things just aren't there. For a while, I kept coming up with this idea that I thought surely people have made. Yet, I never found anything that did it. My thoughts were something like this:
- A bot would read the presences (current game activity) of a user on a server
- The bot would match the game against custom rules configured by an admin
- The bot would assign roles to the user if the admin had configured it to, e.g. an Overwatch role might get assigned to somebody playing Overwatch.

It seemed so simple and so widely applicable in my mind that I was astounded nobody did it. I spent about a year and a half thinking about it before I decided, f*ck it, I'm going to learn to write discord bots.

So I set off to learn to make bots. I found discord.js (great library btw) and started using it to build out a test platform that would read user activities into a json file for the bot to use. I spent a couple weeks on it and eventually reached a point where I realised I had no idea what I was doing and had written a pile of garbage. So I left it and went back to my studies. I figured it'd just be one of those projects I have that I just have some fun with and leave behind.

Little did I know of course, that by the power of procrastination, six months later I'd pick it up and overhaul the entire bot to something that was functional. I'd done it, it was finally working! What's more, was it was even more of a pile of garbage than before. I'd kept the JSON storage except now I was saving it and reading it from a .json file. With only about 10 people interacting with the bot it had filled nearly 4KB and was slowing down a fair bit trying to continually read/write to the file.

So, I went off to reddit in search of wisdom and asked the faceless masses, what might be the best way to store a sh*tton of user data quickly and easily. Thus, a thousand (read: a dozen) voices cried out in unison (read: within about half an hour) and exclaimed: "Why the heck are you using JSON, go use a database instead."

So, I went back to my app and rewrote the entire project once more, using PostgreSQL. Now it was speedy, it was working, and it was time to bring it online. I started adding it to a few servers I was admin on to see how it handled actual users. Despite my best efforts, it ended up working pretty well, and after redoing the command system with the commando.js library (great library, would recommend), I sent my bot out into the wild lands of [TOP.gg](https://top.gg/bot/591955603308675073).

It gained traction quickly, reaching thousands of users in the first day, although that ended up just being because I added it to the top.gg discord server so they could verify it. Regardless, it was alive and running on a Raspberry Pi 2 to boot. My dream was finally here and in a surprising turn of events, I actually finished something I started. The bot slowly but surely gained users as people adopted it into their communities and servers. It only did one thing, but it did it quietly, it did it smoothly and it did it well, which was all most people needed.

Now it has been expanded by users into English, Spanish and Russian, and currently operates on 111 (as at 20/5/20) different communities inside discord, regularly reporting online user counts (that it interacts with and monitors statuses of) of over 150K. I never expected the bot to take off nearly as much as it did, much less hold out on a little raspberry pi. Regardless it did, and it does and I still look back at this as one of my favourite projects I've ever worked on.

Recently, I got contacted by the Discord team after they announced sweeping changes to their bot program and was invited to apply for verification on my bot. So I went through the process and now I have a shiny tick on my bot and a shiny badge on my profile. 

![Discord Dev Badge](https://i.imgur.com/RBwyK3c.jpg)

Currently, I'm working on some open source projects that I've been invited onto, as well as finishing off my last year of Australian High School and planning out some overhauls to my trusty bot using the new Gateway Intents system that Discord are rolling out. My story probably isn't the most glamorous or the most interesting, but I think it carries an important message. The best ideas you'll ever have are the ones you need to have. That is to say, if you want something and can't find it, don't wait for someone else to do it and don't stop if they've done it before you but you can do it better. These ideas are the ones you'll come back to time and time again and finish, because these ideas are the ones that you know you'll need and that you know others will need too, and that, more than anything else, is the magic behind a project that gets finished.

If you want to check out the source or modify it yourself, feel free to check it out [here](https://github.com/benjaminlamont/discord-autorole)!