Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Build and deploy docs

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
repository_dispatch:
types:
- listenarr_release
schedule:
- cron: '0 */6 * * *'

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: listenarr-docs-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout docs repo
uses: actions/checkout@v4

- name: Resolve Listenarr ref
id: listenarr-ref
shell: bash
env:
EVENT_REF: ${{ github.event.client_payload.ref }}
run: |
if [ -n "$EVENT_REF" ]; then
echo "ref=$EVENT_REF" >> "$GITHUB_OUTPUT"
else
echo "ref=canary" >> "$GITHUB_OUTPUT"
fi

- name: Checkout Listenarr
uses: actions/checkout@v4
with:
repository: Listenarrs/Listenarr
ref: ${{ steps.listenarr-ref.outputs.ref }}
path: _listenarr
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Install docs dependencies
run: npm ci

- name: Sync Listenarr API bundle
id: sync-listenarr
continue-on-error: true
env:
LISTENARR_REF: ${{ steps.listenarr-ref.outputs.ref }}
run: npm run sync:listenarr -- --repo ./_listenarr

- name: Checkout Listenarr canary fallback
if: steps.sync-listenarr.outcome == 'failure' && steps.listenarr-ref.outputs.ref != 'canary'
uses: actions/checkout@v4
with:
repository: Listenarrs/Listenarr
ref: canary
path: _listenarr
fetch-depth: 1

- name: Sync Listenarr API bundle from canary fallback
id: sync-listenarr-canary
if: steps.sync-listenarr.outcome == 'failure' && steps.listenarr-ref.outputs.ref != 'canary'
continue-on-error: true
env:
LISTENARR_REF: canary
run: npm run sync:listenarr -- --repo ./_listenarr

- name: Verify committed API bundle fallback
if: steps.sync-listenarr.outcome == 'failure' && (steps.listenarr-ref.outputs.ref == 'canary' || steps.sync-listenarr-canary.outcome == 'failure')
shell: bash
run: |
set -euo pipefail
required_files=(
"static/api-ui/index.html"
"static/api-ui/openapi.json"
"static/api-ui/swagger-initializer.js"
"static/api-ui/swagger-ui-bundle.js"
"static/api-ui/swagger-ui-standalone-preset.js"
"static/api-ui/swagger-ui.css"
"src/data/listenarr.generated.json"
)

missing=0
for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
echo "Missing fallback file: $file"
missing=1
fi
done

if [ "$missing" -ne 0 ]; then
echo "Listenarr sync failed and no committed API bundle fallback is available."
exit 1
fi

echo "::warning::Listenarr sync failed; using the committed API bundle fallback for this docs build."

- name: Build docs site
run: npm run build

- name: Setup Pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v5

- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
build/
.docusaurus/
.cache/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# listenarr.github.io
# Listenarr Docs

Documentation website for Listenarr, built with Docusaurus.

## Local development

```bash
npm install
npm run sync:listenarr -- --repo ../Listenarr
npm run start
```

## Production build

```bash
npm run build
```

The bundled API UI and OpenAPI document are generated from the Listenarr repo by `scripts/sync-listenarr.mjs`.
139 changes: 139 additions & 0 deletions docs/configuration/discord-bot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
sidebar_position: 6
---

# Discord bot

Listenarr includes a built-in Discord request bot workflow so users can request audiobooks from Discord with slash commands.

Open `Settings -> Discord Bot` to configure it.

## Prerequisites

Before you enable the bot, make sure you have:

- a Discord application and bot token from the Discord Developer Portal
- a public URL for your Listenarr instance
- Node.js 20+ available for non-Docker installs if your deployment needs the helper runtime

For Docker deployments, set:

```bash
LISTENARR_PUBLIC_URL=https://your-domain.com
```

That URL is important for public or reverse-proxied deployments and is the first URL the bot integration tries to use.

## Create the Discord application

1. Go to `https://discord.com/developers/applications`.
2. Create a new application.
3. Add a bot user to the application.
4. Copy the `Application ID`.
5. Copy the `Bot Token`.

## Configure the Listenarr fields

### Enable Discord Bot Integration

Turn this on first so Listenarr knows these settings should be used.

### Discord Application ID

The application or client ID from Discord. Listenarr uses this to generate the invite URL and register slash commands.

### Discord Guild ID (optional)

Use this for testing in one server. Guild-scoped command registration updates faster than global registration.

### Discord Channel ID (optional)

If set, the bot only accepts requests from that channel. This is useful when you want to keep requests limited to one place.

### Bot Token

The bot token from the Discord developer portal. Keep it secret.

### Command Group Name

Default: `request`

This is the main slash command group.

### Subcommand Name

Default: `audiobook`

With the default values, your command becomes:

```text
/request audiobook <title>
```

### Bot Username (optional)

Custom display name for the bot.

### Bot Avatar URL (optional)

Optional avatar image URL for the bot.

## Invite the bot

Once the Application ID is filled in, Listenarr can:

- open the invite URL
- copy the invite URL
- check whether the bot is installed

Use the generated invite controls from the settings page rather than manually building the OAuth URL unless you specifically need custom permissions.

## Register commands

After the token and application ID are saved, use:

- `Register commands now`

Do this any time you change:

- the command group name
- the subcommand name
- the guild restriction

## Bot process control

The settings page also exposes process controls:

- `Refresh Status`
- `Start Bot`
- `Stop Bot`

Use them to confirm whether the bot process is actually running after configuration.

## Recommended setup flow

1. Set `LISTENARR_PUBLIC_URL`.
2. Save the Application ID and Bot Token.
3. Optionally save a Guild ID for faster testing.
4. Invite the bot to your server.
5. Register commands.
6. Start the bot.
7. Test a request from Discord.

## Troubleshooting

### Commands are not showing up

- verify the Application ID and Bot Token
- register commands again
- if you are testing, set a Guild ID and re-register

### Bot starts but cannot respond correctly

- verify `LISTENARR_PUBLIC_URL`
- make sure the Listenarr instance is reachable from where the bot is running
- check whether the bot is restricted to a specific channel

### Docker users

If the bot cannot talk back to Listenarr, confirm the container has the correct `LISTENARR_PUBLIC_URL` and that the URL resolves externally the same way your users reach the site.
Loading
Loading