Skip to content

A simple bot for keeping track of leaderboard times from the comfort of a Discord channel

Notifications You must be signed in to change notification settings

shlynz/Neon-White-Discord-Leaderboard

Repository files navigation

Neon White Discord Leaderboard

This is a bot that intends to improve the experience of racing against your server members. I think it's annoying to have to click through every stage, just to check if someone has beaten my times. Our current workaround to this is posting a screenshot in a specified channel, but images are difficult to search for. Thus, you can't quickly check, if that one level you're really proud of has been beaten. This bot aims to improve that experience with the help of commands, to quickly check the status of a stage or user.

Commands

  • /deletetime <mission> <stage>
    • Deletes your current top time for the specified stage
  • /register
    • Registers the calling user to the db
  • /time <mission> <stage> <time>
    • Adds a new time for the calling user to the db
  • /todo
    • Shows stages you currently don't have the top time in
  • /top [mission] [stage]
    • Shows the top time(s) for the specified query. Shows all top times if nothing is specified
  • /userinfo [user]
    • Shows the top times of the specified user. If none specified, calling user is used

Setup

Requirements

  • Node
  • The JSON-Server Node module
    • This Package can be installed with npm install json-server
  • A Discord account, to create a Bot-User
    • You also need the permission to add a bot to the Server you want to use this with. If it's not your server/you're not admin you probably don't have the permission.
  • The ZIP of this repo

Prepping

  1. Extract the ZIP
  2. Rename data/db_template.json to data/db.json
  3. Rename .env_template to .env
  4. Run npm install in the root directory
  5. Enter the URL of the db instance in the .env-File (default port is 8000)
  6. If you're unsure on what to type here, just enter http://localhost:8000

Creating the Discord bot

  1. Open the Discord developer portal and log in
  2. Create a new application with the "New Application" button in the top right
  3. Enter a name for the application and confirm the creation by clicking the "Create" button
  4. In the now open page, you can set/edit the name,
  5. Now click on the "Bot" tab on the left
  6. Add a Bot account by clicking the "Add Bot" button and confirm with "Yes, do it!"
  7. Customise your bot by specifying a name or adding a profile picture
  8. Copy the now presented token to the .env-File
  9. Go back to the "General Information" tab and copy the appliction ID to the .env-File

Starting the bot

  1. Open two command line instances in the root directory of the project
  2. Type node . in one of them
  3. Type npm run db in the other one

Inviting the bot to your server

  1. Go to "My Apps"
  2. Select the application
  3. Navigate to the "URL Generator" in the "OAuth2" tab
  4. Select bot and applications.command
  5. In the just opened BOT PERMISSIONS section, select "Send Messages"
  6. Copy the link at the bottom of the page and paste it in your browser
  7. Select the server you want to add the bot to and confirm by clicking "Authorize"
  8. If you don't see the desired server in the dropdown, you probably don't have the permission for that server

Current version:

The current version of this bot is technically in a useable state, even though it's still in developement. The main features are present, times can be added and are being tracked, the internal leaderboard works and you can get a personal todo list of stages you don't have a top time in. Feel free to use this on your own or even add your own features.

TODOs

  • Implement timekeeping, the main feature LUL
  • Add a list of available commands
  • Add instructions on how to set up
  • Allow for confirmation after a user submits a new time
    • Allow for confirmation only after placing better than specified place
  • Improve usability to broaden the usecase of this bot (eg. Trackmania)
  • Improve readability of /userinfo. The current wall of text is way to big
  • Add command to remove a time
  • Setup and use Docker
  • Very ambitious: Try to read new times from screenshots

About

A simple bot for keeping track of leaderboard times from the comfort of a Discord channel

Topics

Resources

Stars

Watchers

Forks