Skip to content

πŸš€ Installation

Manuel edited this page Jun 10, 2023 · 16 revisions

After you've created your own Discord bot, it's now time to assign this to your application.

Obtaining the token

To connect the bot to your application, you must have the Bot token. This can be obtained in the "Bot" page:

image

Confirm your action by clicking the blue button:

image

If your account has 2FA enables, you'll be prompted to enter your OTP:

image

Next, click this button to copy the token:

image

Warning: Treat the token like a password. It will permit applications to use your bot and all permissions associated with it. If your token is being leaked or shared with other people, they will most likely aim to destroy your server - regardless if your Jellyfin server is reachable from the outside. Do not trust anyone!

Installing the application

We use 3 installation methods for installing the bot. You may choose any out of them, but some may require some technical knowledge. We recommend Method 1 for the easiest installation.

WARNING: Do not suffix your JELLYFIN_SERVER_ADDRESS with /, /web or /web/index.html. This will not work. The URL must end on the base hostname, not on a subpath.

The required values for the environment variables are documented here: https://github.com/manuel-rw/jellyfin-discord-music-bot/wiki/%F0%9F%93%84-Environment-Variables . Set DISCORD_CLIENT_TOKEN to your token, that you copied previously.

Method 1: Use Docker run

You must install the following software:

  • Docker
docker run \
-p 3000:3000 \
-e DISCORD_CLIENT_TOKEN='' \
-e JELLYFIN_SERVER_ADDRESS='' \
-e JELLYFIN_AUTHENTICATION_USERNAME='' \
-e JELLYFIN_AUTHENTICATION_PASSWORD='' \
ghcr.io/manuel-rw/jellyfin-discord-music-bot:latest

Method 2: Use Docker Compose

You must install the following software:

  • Docker
  • Docker Compose
version: '3.3'
services:
  manuel-rw:
    ports:
      - '3000:3000'
    environment:
      - DISCORD_CLIENT_TOKEN=
      - JELLYFIN_SERVER_ADDRESS=
      - JELLYFIN_AUTHENTICATION_USERNAME=
      - JELLYFIN_AUTHENTICATION_PASSWORD=
    image: 'ghcr.io/manuel-rw/jellyfin-discord-music-bot:latest'

Method 3: K8S

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jellyfin-discord-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jellyfin-discord
  template:
    metadata:
      labels:
        app: jellyfin-discord
    spec:
      containers:
        - name: jellyfin
          image: "ghcr.io/manuel-rw/jellyfin-discord-music-bot:latest"
          env:
            - name: DISCORD_CLIENT_TOKEN
              value: ""
            - name: JELLYFIN_SERVER_ADDRESS
              value: ""
            - name: JELLYFIN_AUTHENTICATION_USERNAME
              value: ""
            - name: JELLYFIN_AUTHENTICATION_PASSWORD
              value: ""
            - name: JELLYFIN_APP_NAME
              value: ""
      dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 8.8.8.8

Method 4: Run from source

Warning: This is the most advanced installation method. Usually, you don't need this unless you know what you're doing. This method requires the following software installed on your device:

  • Git
  • NodeJs
  • Yarn
  • FFmpeg

Step 1: Downloading the source code

git clone https://github.com/manuel-rw/jellyfin-discord-music-bot.git
cd jellyfin-discord-music-bot/

Step 2: Install dependencies

yarn

Step 3: Create configuration Create a .env file in the root of the project:

DISCORD_CLIENT_TOKEN=
JELLYFIN_SERVER_ADDRESS=
JELLYFIN_AUTHENTICATION_USERNAME=
JELLYFIN_AUTHENTICATION_PASSWORD=

Here, you can enter your secrets and credentials.

Step 4: Build Application You're almost done! Before you can start your new Discord bot, you must create a production build.

You can do this by entering

yarn build

in the console. This will generate a new directory called dist/ with a few files in it. These files are necessary for getting the bot to work.

Step 5: Start application If all previous steps went well, you can now start the bot.

yarn start:prod

Common issues

Disallowed intent

If you get an error, like the following, you might need to fix your discord application.

[Nest] 28  - 06/09/2023, 7:41:35 PM   DEBUG [JellyinPlaystateService] Reported playback capabilities sucessfully
/app/node_modules/@discordjs/ws/dist/index.js:1066
        throw new Error("Used disallowed intents");

Ensure, that you've set the intents correctly:

You might need to re-invite your bot after updating those. If this doesn't work, you need to re-create the application.