keyboardmedicNL / Assetto-corsa-discord-leaderboard

takes assetto corsa lap times,shmoovin scores and general server information and posts them to a leaderboard on discord trough a webhook
3 stars 0 forks source link
assetto corsa discord laptimes leaderboard serverinfo shmoovin webhook

what does it do:

a server sided script that reads logs from assettoserver and acServer for lap times, stage times (found on shutoko), shmoovin score entries and general server information and posts them to a leaderboard posted via discord webhooks aswell as html files in a html folder to use as live overlays in obs.

it makes as many messages as there are servers and will delete them if the server no longer exsists.

it loops trough a parent folder housing all servers and uses a configurable identifier to identify server folders. if it sees a server folder it looks in that folder for a logs folder or a results folder where it will then loop trough the last log file to find score entries. it will NOT work with different folder structures (example below). it saves the scores and laptimes to a leaderboard txt and a laptimes txt in the root of the server wich can be added manually to remove or reset scores.

If there is no shmoovin script present in the csp config in the server folders cfg folder it will not trigger and leave the folder alone. It gets the server name from the server config.

if there are too much characters in the discord message the bot will limit the amount of entries until it fits.

laptimes and full server info can be set on or off in the configs as described below.

screenshots

alt text

alt text

how to use:

  1. install python on your system from the python website https://www.python.org/downloads/ make sure to select add python to path
  2. install the requests module trough pip with the following command in a terminal
    python -m pip install requests
  3. in the config folder copy the provided example_config.json and rename it to config.json
  4. configure the config.json as needed:
    {
    "interval": time in minutes on how often the script should update the leaderboards,
    "serverspath": ["path/to/server_parent_folder1", "path/to/server_parent_folder2"],
    "folderindentifier": "identifier to recognize server folder",
    "leaderboardlimit": how much entries should be displayed on the leaderboard,
    "webhookurl":"url to your discord webhook",
    "shmoovindrifturl":["url to drift script"],
    "shmoovinovertakeurl":["url to overtake script"],
    "serveradress":"ip adress of server",
    "serveradressdisplay":"ip adress used in bot messages and link (incase serveradress is localhost)",
    "onlyleaderboards":"wether or not to show the full server info or leadeboards only, set to "true" or "false" "
    "show_input": "shows input method used by the driver, "true" or "false"",
    "verbose": "set script output to verbose for debugging "true" or "false""
    "log_to_file": "logs all output to a file for debugging "true" or "false" WARNING does not limit filesize yet"
    }
  5. save the file and run the script:
    on windows: with the provided start.bat file OR trough a terminal with "python leaderboard.py".
    on linux: in the terminal with "python leaderboard.py".

extra configuration options

disclaimer

scripts are written by an amateur, use at your own risk...