From 2645511d9f7ca299a21c8b7c15f680874f857472 Mon Sep 17 00:00:00 2001 From: artiume Date: Sun, 25 Oct 2020 21:23:26 -0400 Subject: [PATCH 1/4] Full Guide to make the bot not sure if you want this in the ReadMe, a different link or dont want it at all, but I thought I would give back some for the awesome bot :) --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index d45cb5c..f93bd53 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,31 @@ You'll need a Discord Application for this Bot to work, as you will host it your [How to invite the Bot to your server](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links) +[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) ### The simplest way to get started is using Docker: From 00259a2619ea725059a899b8b96581bcff949e3d Mon Sep 17 00:00:00 2001 From: artiume Date: Mon, 26 Oct 2020 08:00:40 -0400 Subject: [PATCH 2/4] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f93bd53..0900cec 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,6 @@ help | Display the help message ## Getting Started You'll need a Discord Application for this Bot to work, as you will host it yourself. -[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) - [Generate an Api and bot here](https://discord.com/developers/applications/). Click New Application. @@ -72,6 +68,12 @@ Authorize your room! ![image](https://user-images.githubusercontent.com/20715731/97124818-08380b80-1708-11eb-944a-f96395dcf6c1.png) +For official documentation + +[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) + ### The simplest way to get started is using Docker: ```bash From 455f7392ce18dcd3e821d049c8822c8983b3f025 Mon Sep 17 00:00:00 2001 From: artiume Date: Mon, 26 Oct 2020 08:06:34 -0400 Subject: [PATCH 3/4] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0900cec..c288b75 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,13 @@ Authorize your room! ![image](https://user-images.githubusercontent.com/20715731/97124818-08380b80-1708-11eb-944a-f96395dcf6c1.png) -For official documentation +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. [How to retrieve your token](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot) From e895e849a29018f7ce3a99ac724da7cf83442cac Mon Sep 17 00:00:00 2001 From: KGT1 Date: Fri, 20 Nov 2020 10:42:21 +0100 Subject: [PATCH 4/4] report position ticks with playback stop --- src/playbackmanager.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/playbackmanager.js b/src/playbackmanager.js index 88fc29b..464cad5 100644 --- a/src/playbackmanager.js +++ b/src/playbackmanager.js @@ -129,6 +129,8 @@ function nextTrack () { } else if (currentPlayingPlaylistIndex + 1 >= currentPlayingPlaylist.length) { throw Error("This is the Last song"); } + jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); + startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish); } @@ -140,6 +142,8 @@ function previousTrack () { startPlaying(undefined, undefined, currentPlayingPlaylistIndex, 0, _disconnectOnFinish); throw Error("This is the First song"); } + jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); + startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish); } } @@ -155,11 +159,7 @@ function stop (disconnectVoiceConnection, itemId = getItemId()) { if (disconnectVoiceConnection) { disconnectVoiceConnection.disconnect(); } - jellyfinClientManager.getJellyfinClient().reportPlaybackStopped({ - userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(), - itemId: itemId, - playSessionId: getPlaySessionId() - }); + jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); if (getAudioDispatcher()) { try { getAudioDispatcher().destroy(); @@ -285,6 +285,17 @@ function getProgressPayload () { return payload; } +function getStopPayload () { + const payload = { + userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(), + itemId: getItemId(), + sessionID: getPlaySessionId(), + playSessionId: getPlaySessionId(), + positionTicks: getPostitionTicks() + }; + return payload; +} + module.exports = { startPlaying, stop,