/krp-discord-bot

Discord Bot that can generate encrypted krp mods.

Primary LanguageTypeScriptMIT LicenseMIT

krp-discord-bot

Discord Bot that can generate encrypted krp mods.

Requirements

Windows

  • git
  • lock.exe (Piboso has the file)
  • Node.js (Tested with 18.17.0)
  • pnpm

Linux

  • git
  • lock.exe (Piboso has the file)
  • Node.js (Tested with 18.17.0)
  • pnpm
  • Wine (32 bit + 64 bit)

Ports

  • Make sure WEBSERVER_PORT is open

Role structure

  1. Patreon role

    Has access to all mods

  2. Mods specific role

    Only access to one mod

Folder structure

  • Mods Folder

    Put all unencrypted mods into that folder and name the file while creating the mod per command

Documentation

Documentation

Installing

General

  1. Open console

  2. Clone Repository:

    git clone https://github.com/FynniX/krp-discord-bot.git
  3. Open Bot Directory

    cd krp-discord-bot
  4. Setup Environment File

    Copy .env.example and rename it to .env

    • DATABASE_URL = "file://PATHTOFILE.db"
    • WEBSERVER_URL = http://YOURPUBLICIP:WEBSERVER_PORT
    • WEBSERVER_PORT (Define a free port for it)
    • MAX_THREADS (How many requests can be done simultaneously, be careful)
    • BOT_TOKEN (Discord bot token)
    • GUILD_ID (Discord server id)
    • PATREON_ROLE (Discord role for access to generating)
  5. Setup Environment

    pnpm install
  6. Mods Folder

    Create a folder called mods Why?

  7. Install lock.exe

    Place lock.exe inside bot directory

  8. Build Source

    pnpm run build
  9. Start Bot

    pnpm start

Linux Extras

  1. Node.js

    wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    nvm install 18.17.0
    nvm use 18.17.0
  2. Wine

    apt update
    apt install wine
    dpkg --add-architecture i386 && apt-get update && apt-get install wine32
  3. pm2

    Can be used to start the bot on startup and run in background.

    npm i -g pm2
    pm2 startup

    Skip step 9 in General Instructions and use this command

    pm2 start pnpm --name KRP-Discord-Bot -- run start
    pm2 save
  4. pnpm

    wget -qO- https://get.pnpm.io/install.sh | sh -

License

Released under the MIT License.