Skip to content

NAMERIO/survev-discord-bot

Repository files navigation

Survev.io Discord Bot

A Discord bot that provides game information and leaderboards for Survev.io using slash commands.

Features

  • /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

Setup

  1. Install dependencies:

    npm install
  2. Configure environment variables:

    • Copy .env.example to .env
    • Fill in your Discord bot token and client ID
    • Optionally add a guild ID for testing
  3. Deploy slash commands:

    npm run deploy-commands
  4. Start the bot:

    npm start

    Or for development with auto-restart:

    npm run dev

Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Create a new application
  3. Go to the "Bot" section and create a bot
  4. Copy the bot token to your .env file
  5. Copy the application ID to your .env file as CLIENT_ID
  6. Go to "OAuth2 > URL Generator"
  7. Select scopes: bot and applications.commands
  8. Select bot permissions: Send Messages, Use Slash Commands
  9. Use the generated URL to invite the bot to your server

Usage Examples

  • /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

API Information

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

Error Handling

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •