discord-jellyfin-bot/README.md

146 lines
5.4 KiB
Markdown
Raw Normal View History

2022-08-07 21:53:30 +02:00
<p align="center">
<img src="https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/jellyfin.png" alt="Jellyfin Logo" width="80" height="80">
<h1 align="center">Jellyfin Discord Music Bot</h1>
<div align="center">
<span>A fork of the <a href="https://github.com/KGT1/jellyfin-discord-music-bot">original project</a> with improved readability and stability, compatible with Jellyfin 10.8.x</span>
</div>
</p>
# ✨ Features
- Simple Discord Bot that hooks into the [Jellyfin](http://github.com/jellyfin/jellyfin) API of your instance
- Request, pause and play songs directly from your Discord Server
- Interactive Media control message to control playback
# 🦾 About this fork
The original version is decent for Jellyfin 10.6.x and before. After the breaking changes of 10.7 and 10.8, users were unable to stream music from their Jellyfin.
For this reason, I made this fork to address those changes to the API and improve the bot with my own ideas / features. Please check out the original project by [KGT1](https://github.com/KGT1).
I will gradually update documentation & code of the bot. Please wait patiently.
<br/><br/><br/><br/><br/><br/><hr/><br/>
2022-08-07 21:53:30 +02:00
## Original README from https://github.com/KGT1/jellyfin-discord-music-bot
2020-09-18 03:18:49 +02:00
Jellyfin Discord Music Bot is a Discord Bot for the [Jellyfin Media Server!](http://github.com/jellyfin/jellyfin)
2022-08-07 21:53:30 +02:00
### Capabilities
2020-09-21 07:58:15 +02:00
2022-08-07 21:53:30 +02:00
#### Play to
2020-10-05 23:39:59 +02:00
2020-10-06 00:18:48 +02:00
Just `summon` the Bot into your Channel, than choose the Bot in Jellyfin as the Device you want to cast to
2020-10-05 23:39:59 +02:00
2020-10-05 23:46:32 +02:00
![Image to Discord Play to Window](img/playtowindow.png)
2020-10-05 23:39:59 +02:00
and start playing you favourite Music
2022-08-07 21:53:30 +02:00
#### Interactive Play Message
2020-10-05 23:39:59 +02:00
When you start playing something you can easily controll the Bot with just clicking on the Buttons under the Play Message
2020-10-05 23:46:32 +02:00
![Image to Interactive Play Message](img/discordplaymessage.png)
2020-10-05 23:39:59 +02:00
2022-08-07 21:53:30 +02:00
#### Commands
2020-09-21 07:58:15 +02:00
Beware that you'll always need to add your prefix(default: ?) in front of the command.
Command | Description
------------ | -------------
summon | Join the channel the author of the message(now you can cast to the Bot from within Jellyfin)
disconnect | Disconnect from all current Voice Channels
play | Play the following item(can be the name of the song or the Stream URL)
2020-10-06 00:18:48 +02:00
add | Add the following item to the current playlist
2020-09-21 07:58:15 +02:00
pause/resume | Pause/Resume audio
2020-09-23 17:39:41 +02:00
seek | Where to Seek to in seconds or MM:SS
skip | Skip this Song
2020-09-30 17:38:43 +02:00
spawn | Spawns an Interactive Play Controller
2020-10-05 21:38:30 +02:00
help | Display the help message
2020-09-21 07:58:15 +02:00
2022-08-07 21:53:30 +02:00
#### Limitations
2020-10-06 00:41:20 +02:00
- No Playlist Repeat Mode.
2020-09-25 13:54:28 +02:00
- Multi Server support.
2022-06-09 13:59:09 +02:00
- [Playing Video Content](https://github.com/discordjs/discord.js/issues/4116) (if Discord ever adds this, I'll implement it into this Bot)
2020-09-21 07:58:15 +02:00
2022-08-07 21:53:30 +02:00
### Getting Started
2020-09-21 07:58:15 +02:00
You'll need a Discord Application for this Bot to work, as you will host it yourself.
[Generate an Api and bot here](https://discord.com/developers/applications/).
Click New Application.
![image](https://user-images.githubusercontent.com/20715731/97124506-bba00080-1706-11eb-820a-035039484ca2.png)
The Name of the application will be the bot's name.
![image](https://user-images.githubusercontent.com/20715731/97124528-d2deee00-1706-11eb-8a05-8b0542e1213a.png)
Go to the Bot tab.
![image](https://user-images.githubusercontent.com/20715731/97124557-ef7b2600-1706-11eb-8fed-2373df9a1eb7.png)
Generate the bot, and grab the token. Also, recommend making the bot private.
![image](https://user-images.githubusercontent.com/20715731/97124639-484abe80-1707-11eb-92f9-1182aad3d2d2.png)
Go to the OAuth2 page, click Bot Scope to get the url authorization link.
![image](https://user-images.githubusercontent.com/20715731/97124754-b68f8100-1707-11eb-9e16-f84401d108bf.png)
Authorize your room!
![image](https://user-images.githubusercontent.com/20715731/97124818-08380b80-1708-11eb-944a-f96395dcf6c1.png)
2020-10-26 13:06:34 +01:00
Next, join a voice channel and connect your bot with ?summon. This will connect your bot to the voice channel you're in and will create the device profile in Jellyfin.
![Image to Discord Play to Window](img/playtowindow.png)
From within Jellyfin, start playing content or from within Discord, use the bot commands to start enjoying music!
For official documentation to creating a bot.
2020-10-26 13:00:40 +01:00
[How to retrieve your token](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot)
[How to invite the Bot to your server](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links)
2020-10-05 21:38:30 +02:00
### The simplest way to get started is using Docker:
2020-10-05 23:46:32 +02:00
```bash
docker run -d \
--name jellyfin-discord-music-bot \
-e DISCORD_PREFIX="?" \
-e DISCORD_TOKEN="yourtokengoeshere" \
-e JELLYFIN_SERVER_ADDRESS="https://jellyfin.DOMAIN" \
-e JELLYFIN_USERNAME="" \
-e JELLYFIN_PASSWORD="" \
-e JELLYFIN_APP_NAME="Jellyfin Discord Music Bot" \
2020-09-30 17:27:09 +02:00
-e MESSAGE_UPDATE_INTERVAL="2000" \
2020-09-23 19:54:22 +02:00
--restart unless-stopped \
kgt1/jellyfin-discord-music-bot
```
2020-09-25 13:54:28 +02:00
2020-10-05 23:39:59 +02:00
MESSAGE_UPDATE_INTERVAL is the amount of time in ms the play message gets updated with the current time
2022-08-07 21:53:30 +02:00
#### Alternatively you can run the Application natively with NodeJS:
2020-09-25 13:54:28 +02:00
Dependencies:
- npm 6.14.6
- NodeJS v12.18.3
- ffmpeg 4.2.4
2020-10-05 23:46:32 +02:00
```bash
2020-09-25 13:54:28 +02:00
git clone https://github.com/kgt1/jellyfin-discord-music-bot.git
cd jellyfin-discord-music-bot
npm install
```
edit config.json and add your token,server-address etc.
2020-10-05 23:46:32 +02:00
```bash
2020-09-25 13:54:28 +02:00
npm run start
```
2022-08-07 21:53:30 +02:00
### How to build
```
git clone https://github.com/kgt1/jellyfin-discord-music-bot.git
cd jellyfin-discord-music-bot
docker build -t YOUR_IMAGE_NAME .
```