A smart monkey design to help players in the community’s discord server.

This bot is designed in typescript to meet the growing demand for updates to the discord api, as discord.js is now the most up-to-date and widely used wrapper, making it easier to develop and maintain our system. What’s more, the use of TypeScript is an advantage, because as a JavaScript overlay we can use the thousands or even millions of libraries and thus extend the possible novelties and functionalities ad infinitum… and everyone knows that TS > JS.

Why Typescript and not Golang ?

As I said, TypeScript is a better choice than JavaScript, but everything can make us think that Golang is a better choice over Typescript. Our choice is simple, 80% of the codebase was developed initially developed on typescript and for maintenance reasons, since only 2 people in the team knows how to dev in Go, it was better to use TypeScript.

[!NOTE] “Go is faster”… we don’t need to be fast there.

Context

As part of our community development strategy, we’ve chosen to use discord, a social network popular with gamers of all kinds, which means we can target more people when we open our services. This bot will enable us to respond to certain user requests automatically, but also to manage and moderate these same users within the community server in order to spread order, joy and good humor, but above all the best gaming experience for users, even outside the game.

Compilation

To “build” this locally, you need to have NPM installed on your machine. Refer to the NPM documentation for more information.

Here’s how you can download it on Ubuntu/Debian :

curl -fsSL https://deno.land/install.sh | sh

Then, run the project:

deno task run token="<discord_token>" rconPass="<password_rcon> dbUser="<database_user>" dbPass="<database_pass>" dbName="<database_name>"

You can also run it in a “dev” environment:

deno task dev

Docker

You can also use Docker for this project, which ensures a consistent build environment. The provided Dockerfile installs all necessary dependencies and sets up the environment.

To build the Docker image:

docker build --build-arg TOKEN= --build-arg RCON_PASS= --build-arg DB_USER= --build-arg DB_PASS=  --build-arg DB_NAME= -t discord:latest .

To run the Docker container:

docker run -d discord