A Discord bot that provides game information and leaderboards for Survev.io using slash commands.
/gameinfo- Display current game modes and player counts by region/leaderboard- Show top 5 players with customizable filters:- Team modes: Solo, Duo, Squad
- Map: Normal, Desert, Woods, 50v50, Potato, Savannah,
- Time intervals: Daily, Weekly, All Time
- Types: Most Kills, Most Wins
/stats- Shows players stats:- Slag: Players in game username
-
Install dependencies:
npm install
-
Configure environment variables:
- Copy
.env.exampleto.env - Fill in your Discord bot token and client ID
- Optionally add a guild ID for testing
- Copy
-
Deploy slash commands:
npm run deploy-commands
-
Start the bot:
npm start
Or for development with auto-restart:
npm run dev
- Go to Discord Developer Portal
- Create a new application
- Go to the "Bot" section and create a bot
- Copy the bot token to your
.envfile - Copy the application ID to your
.envfile asCLIENT_ID - Go to "OAuth2 > URL Generator"
- Select scopes:
botandapplications.commands - Select bot permissions:
Send Messages,Use Slash Commands - Use the generated URL to invite the bot to your server
/gameinfo- Shows enabled game modes and player counts/leaderboard team:solo interval:daily- Daily solo kills leaderboard/leaderboard team:duo interval:weekly type:most_wins- Weekly duo wins leaderboard/leaderboard team:squad interval:alltime- All-time squad kills leaderboard
The bot uses the Survev.io API:
- Site Info:
https://api.survev.io/api/site_info?language=en - Leaderboard:
https://api.survev.io/api/leaderboard
The bot includes comprehensive error handling for:
- API failures and timeouts
- Invalid responses
- Network connectivity issues
- Discord interaction errors
All errors are logged to the console and users receive friendly error messages.