CC-117

This is a Discord bot that I made for my Wynncraft Guild. It reads various data from the Wynncraft public API and stores raw and edited data in a database which the bot can then access to perform various tasks.

The bot is actually split into 2 programs, one that is the actual bot which responds to user interaction, and the other is what reads from the API and populates the database. This way, if the bot is being used in multiple servers it won't be overloaded with API requests as it will only read from the database.

The bot started out as a way to automatically apply roles in the Discord server based on their in-game stats, so if they had the Chief rank in the Guild, they would be given the Chief rank in the Discord server. This feature has expanded to include other roles such as their donator rank, server rank and level.

The bot sending a message on how many members have had their roles updated.

After looking more into the API, I thought of some more features that could be included in the bot. So the next feature I implemented was the ability to track other guilds and get a rough idea on how many players each guild had online at a time.

This would keep track of a running average of the players online over the course of a week and also how many of those players had the rank of captain or above. It also displays the same information but for how many are currently online, instead of the average.

The bot responding to the trackedguilds command.

The next feature was an extension of tracking guilds and it tried to find the most and least active hours for a guild, those being when they had the most or least players online in the last 24 hours.

The bot would display the average number of online players and online captains at each hour for the last week. It also allows you to change what timezone this information is displayed in, as by default it shows in UTC.

The bot responding to the activehours command.

Next I added the ability to see how long it has been since every member in a guild logged in. It displays the username, guild rank and how many days it has been since the user logged in. If they are currently online, then it will say that.

The bot responding to the lastlogins command.

You can also set in your config file the threshold for each rank and how long they are allowed to be inactive for before they will be removed from the guild. When a member is over the threshold they will be highlighted in red, otherwise they will be highlighted green. This will only work if the guild you are checking the last logins for is the guild your server represents and since it is your guild, it will also display the highest level class that user has as that can be a factor in whether they should be kicked or not.

The bot responding to the lastlogins command for our guild.

Another command is /worldactivity which allows you to see which world has the most players on in a specific guild.

The bot displaying the number of players currently online in the guild Profession Heaven.

Some more functionality I added was the ability to set what requirements you have for people to be promoted in the guild, this way you can easily run a command to see who should be promoted.

The bot displaying a list of players who should be promoted and the reason(s) why.

And I later added the same for demotions, which simply checked if someone had a rank but did not meet the requirements for.

The bot displaying a list of players who should be demoted and the reason(s) why.

I also added the ability to exempt people from promotion/demotions, so if someone was untrustworthy they could be exempt from appearing in the promotions list despite meeting the requirements and the same for demotions so if they had good strategies but did not meet the requirements for strategist, they would not be in the demotion list.

A message can be generated for users to show interest in when the guild participates in wars, from there they can also choose which war role they are able to perform.

The bot displaying the class message and the following archetype message and the message saying you have been given the roles.

Similarly to the war message, there is also a message to select your favourite class & archetype, however unlike the war message you can only have 1 pair of roles.

The bot displaying a list of possible guilds given the prefix pun.

Some guilds have the same name and/or prefix but with different capitilisation, so in these cases the bot will present the options of which guild you meant and you can click one of the buttons to make the choice.

The bot displaying the war message and the following war role message and the message saying you have been given the role.

There also exists a command /viewconfig to easily see all of the configurations you have made to the bot so if you want to see what you set an option as, you can simply run this command to see if the option is already set to what you want. Since there are a lot of options, they are sorted and displayed on different pages.

The bot displaying a user friendly version of the config file for the current server.

I originally wrote the bot in Python when it was simply just updating roles but as I wanted to add more features I swapped to Java to support slash commands and later when I wanted to swap to using a database rather than text files I rewrote the bot in JavaScript.

The bot currently supports multiple Discord servers as each has their own config file, however I am still testing it to ensure everything works and once I am happy with the configurability of the bot I hope to release it publicly.

Every midnight in UTC the bot will update the roles of each member of a server that has the auto updateranks feature enabled to match their values in the database. Currently, this works fine as I am only testing it in 1 server, but this may be a problem when I eventually allow it to be invited to other servers so I would like to find a better way of doing this, as running it for multiple servers could slow the bot around this time.

The GitHub repository for the new JavaScript bot is available here.

The GitHub repository for the old Java bot is available here.