self-hosting

❗ do whatever you want with foxtrot's source code, just stay in line with AGPL-2.0

prerequisites

PostgreSQL server is not needed, because on development environment it uses SQLite3, however it is recommended that you set it up because running things on a development environment is generally a bad practice.

setting up

clone foxtrot.ts repository into the workspace and install dependencies.

Bash
$git clone https://github.com/LitterbinCollective/foxtrot.ts.git && cd foxtrot.ts/ && npm install
Click to copy

configuration

configure the application using *.example.json files in the configs/ directory as a template.

formats.json is unused, and you may leave it empty:

{}

app.json fields

🫠 shard config variables will not be described in detail.
⚠️ all of these fields need to be in their supposed types (just as in the example). otherwise, TypeScript code will not compile.
namedescriptionrequired
tokenDiscord bot token.yes
prefixdefault message-content-based prefix.yes
proxyHTTPS proxy. if you do not have one, leave it empty: "".no
feedbackWebhookfeedback webhook. it is also used to report any cluster crashes. you need to extract the ID and the token of the webhook from its URL.yes
devIdowner/runner user ID on Discord. it is used only to ping the user on cluster crashes.yes
shardCountset it to 1.yes
shardStartset it to 0.yes
shardEndset it to 1.yes

configuring shat.json

the only thing that you need to specify here is the gitHubToken field. everything else does not need to be modified.

go here and create a new token, then put it into the gitHubToken variable.

creating a separate repository for sound effects (or otherwise chatsounds) will not be described in detail, however if you would like to use your own chatsounds GitHub repository with foxtrot, add an object to sources, templated to the following structure:

    // author/repository-name#branch
    "Metastruct/garrysmod-chatsounds#master": {
      // bases (array of paths)
      "bases": ["sound/chatsounds/autoadd"],

      // if you somehow managed to create a msgpack file for chatsounds
      "useMsgPack": false
    },

configuring Knex

create a user and a database in the PostgreSQL server if you have not done it already.

in the root of the project, copy knexfile.example.ts to knexfile.ts and configure it.

after configuring, you need to run migrations. to do that, you need to run the following:

Bash
$npx knex migrate:latest
Click to copy

configuring Spotify

if needed, you may add support for Spotify by following these instructions:

  1. extract client ID and private key with https://github.com/wvdumper/dumper.
  2. extract cookies (in Netscape format) from open.spotify.com while being logged in.
  3. put these files into configs/ folder and name them accordingly:
  • Widevine client ID: widevine_client_id.bin
  • Widevine device private key: widevine_private_key.pem
  • cookies: spotify_cookies.txt

if the needed files are missing, Spotify as a format will not be considered supported by foxtrot.

almost done

build the application, including the C++ audio mixer.

Bash
$npm run build
Click to copy

to run it under production, you need to set NODE_ENV environment variable to production and then just run npm run start.