After many months I have finally finished
my first Discord bot.It's a simple idea, it's a mutal ban bot. However it took so long because I managed to incorporate some neat features that required me to learn new tools like MongoDb, Discord.js, and JavaScript.
My favourite part is the connection to the databases. There are two reasons why the bot would read or write:
When a user joins: The bot retrieves the
user's Id through the guildMemberAdded event and checks to see if its part of the blacklisted collection. If it is, then a second request is made to the second collection where the
guild Id is used as a filter to obtain a channel Id.
The bot checks if it has parameters, and a message is sent.
When a user blacklists: The bot takes the target's Id, the reason, (both of which are slash command parameters), the guild Id, and the author/blacklister. This is then
written to the database and a
messsage is sent to a central announcement channel which all participating servers follow. (This is so people can still get blacklisted even if the bot goes down!)
I was lucky enough to have
an amazing profile picture designed for me by an eager mod, and I love how it turned out. (Bonus points for it matching with the DND status!)