A Discord bot for the Sourcemod Surftimer plugin.
This bot provides basic commands such as /playerstats <playerid>
, /mapstats <mapname>
and /top
.
The bot can also generate custom images of new records when they are set.
It uses the discord.js library and the prisma ORM.
- A huge thanks to Sayt123 for their collection of surf map images, without which this bot would not look nearly as good!
- Install Docker.
- Create a directory called
SurfTimer-Bot
---mkdir SurfTimer-Bot
- In this directory, create a file named
docker-compose.yml
---nano docker-compose.yml
. - In this
docker-compose.yml
, copy/paste the contents of this file. - In this
docker-compose.yml
, edit the environment variables accordingly (follow the URL for a detailed guide). - Now run the container with
docker compose up -d
.
- Install Node.js (v16.13.2 minimum!) and NPM (should be installed with Node).
- Clone this repository or download its content somewhere.
- Create a file named
.env
. - In this file, paste the contents of this file.
- Edit the environment variables accordingly (follow the URL for a detailed guide).
- Open a terminal and run
npm i && npm run build
- To start the bot, run
npm run start
- Install the plugin in
addons/sourcemod/plugins
on your server. - Run it once to generate the config file at
cfg/sourcemod/SurfTimer-Discord-Bot.cfg
. - In this config file, set your hostname, the port of the API (3000 by default) and the API key you've configured in the previous steps (in your .env file).
- Reload the plugin and make sure everything is working with the command
!ck_discord_bot_test
.
This project uses TypeScript, Axios, and the Prisma ORM. It takes advantage of Discord.js to interact with the Discord API.
This project has been created for easy collaboration. You SHOULD use Visual Studio Code to work on this project, as it uses TypeScript and the Prisma ORM, as well as a debugging server, all configured to work with VSCode out of the box.
- Fork the repository and clone it somewhere on your machine.
- Make sure Node.js (v16.13.2 minimum!) and NPM (should be installed with Node) are installed.
- Create a file named
.env
. - In this file, paste the contents of this file.
- Edit the environment variables accordingly (follow the URL for a detailed guide).
- Run
npm i
to install the dependencies. - Open a terminal in VSCode and type
npm run watch
. - Once you want to run the bot, hit F5, the bot should start in a debug session.
The only thing contributors can do is to add new commands (if you have anything in mind, feel free to PR of course). To do so, all you have to do is create a file in the commands
folder and adapt the code from another command such as top.ts
.