05/09/21 • Backend

KlineAccounts Landing Page

With the prevelent problem of public Discord bots not having the option to customise the name of server statistics channels, I came up with a solution to create my own bot which includes this functionality. This feature was then successfully implemented in the Discord server of Million Token, a multi-chain cryptocurrency I have interned at as one of their backend developers.

Discord Statistics

It features the ability to display the count of users in a Discord server in total, current users online, and the amount with users with a specific role (role is changebale to liking). This is set out in a simplistic order for personal customisation of how the voice channel would be named.

                        
                            totalUsers.setName("Total Users: " + userCount)
.then(newChannel => console.log(`Stat channel renamed to: ${newChannel.name}`))
.catch(console.error);

onlineUsers.setName("Online Users: " + onlineCount)
.then(newChannel => console.log(`Stat channel renamed to: ${newChannel.name}`))
.catch(console.error);

roles.setName("Coders: " + coderCount)
.then(newChannel => console.log(`Stat channel renamed to: ${newChannel.name}`))
.catch(console.error);
                        
                    

By using discord.js, I was able to interact with the Discord API which essentially is making a GET request to retrieve the data necessary.

This project is open source and can be viewed using the steps I have provided on my github repository. The repository can be viewed here