A DayZ bot written in Javascript to display your leaderboard using the CFTools Cloud API.
This project has been archived and has since been replaced with cftools-discord-bot, a bot that that fully utilizes the CFTools Data API and offers way more than just a leaderboard
Come try the bot yourself in our official support server!
- Node.js
- Head over to the download page
- Download the latest LTS available for your OS
- Be sure to check the box that says "Automatically install the necessary tools" when you're running the installation wizard
- A Discord Bot account
- Head over to the page linked above
- Click "New Application" in the top right
- Give it a cool name and click "Create"
- Click "Bot" in the left hand panel
- Click "Add Bot" -> "Yes, do it!"
- Click "Rest Token" and copy it to your clipboard, you will need it later
- Download the latest release here
- Extract/unzip the downloaded compressed file into a new folder
- Open a command prompt in the project root folder/directory
- On Windows you can type
cmd.exe
in the File Explorer path - Root folder structure:
- commands/
- local_modules/
- .env.example
- index.js
- etc...
- On Windows you can type
- Run the command
npm install
- Copy-paste the
.env.example
file in the same directory and re-name the created file to.env
- Open the
.env
file and fill in your valuesCLIENT_ID
: Can be grabbed by creating a new application in your Discord Developer PortalDISCORD_BOT_TOKEN
: After creating your bot on the link above, navigate toBot
in the left-side menu to reveal your bot-tokenCFTOOLS_API_APPLICATION_ID
: Application ID from your CFTools Developer Apps - Authorization has to be granted by navigating to theGrant URL
that's displayed in your app overviewCFTOOLS_API_SECRET
: Same as above, clickReveal Secret
- Open the
config/servers.example.json
file and rename it toservers.json
. Fill in your values.CFTOOLS_SERVER_API_ID
: ClickManage Server
in your CF Cloud Panel >Settings
>API Key
>Server ID
- Add the bot to your server by using the following link: (Replace CLIENT-ID with your CLIENT_ID from before) https://discord.com/api/oauth2/authorize?client_id=CLIENT-ID&permissions=0&scope=bot%20applications.commands
- Run the command
node .
in the project root folder/directory ornpm run start
if you have PM2 installed to keep the process alive.
Server configuration is managed through the /config/servers.json
file, here is a quick reference of what the values mean.
This is NOT valid JSON, as you should NOT use this file, use the example instead
[
{
// The name to display when selecting servers with /leaderboard and /stats
"name": "Name to display - server WITH automatic leaderboard",
// Click `Manage Server` in your CFTools dashboard (https://app.cftools.cloud/dashboard) > `Settings` > `API Key` > `Server ID`
"CFTOOLS_SERVER_API_ID": "Your secret server API id",
// Should the automatic leaderboard be enabled
"AUTO_LB_ENABLED": true,
// ID of the channel to post the automatic leaderboard to
"AUTO_LB_CHANNEL_ID": "806479539110674472",
// How often should the leaderboard be updated
"AUTO_LB_INTERVAL_IN_MINUTES": 60,
// Should old leaderboard data/messages be deleted
"AUTO_LB_REMOVE_OLD_MESSAGES": true,
// The amount of players to show on the leaderboard
"AUTO_LB_PLAYER_LIMIT": 25
}
]
Check out this video by The Coding Train
Yes. Your DayZ server has to be connected to the CFTools Cloud API and needs the GameLabs integration mod.