Coder Social home page Coder Social logo

armed-dockers / plex-discord-bot_v2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from irbyk/plex-discord-bot_v2

0.0 0.0 0.0 593 KB

Upgrade of the Plex-Discord-Bot by danxfisher : https://github.com/danxfisher/Plex-Discord-Bot

License: BSD 3-Clause "New" or "Revised" License

JavaScript 99.68% Dockerfile 0.32%

plex-discord-bot_v2's Introduction

Note : this is a personal upgrade of the Plex Discord bot made by danxfisher available here : https://github.com/danxfisher/Plex-Discord-Bot He should have all the credit for starting this project.

Plex Discord Bot

Installation

  1. Clone the repo or download a zip and unpackage it.

If you to use Docker , skip the points 2 and 3.

  1. Install Node.js: https://nodejs.org/

  2. Navigate to the root folder and in the console, type npm install

    • You should see packages beginning to install
  3. Once this is complete, go here: https://discordapp.com/developers/applications/me

    1. Log in or create an account
    2. Click New App
    3. Fill in App Name and anything else you'd like to include
    4. Click Create App
      • This will provide you with your Client ID and Client Secret
    5. Click Create Bot User
      • This will provide you with your bot Username and Token
  4. Take all of the information from the page and enter it into the config/keys.js file, replacing the placeholders.

  5. Navigate to the config/plex.js file and replace the placeholders with your Plex Server information

    1. To get your token, following the instructions here: https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token
    2. The identifier, product, version, and deviceName can be anything you want
  6. Once you have the configs set up correctly, you'll need to authorize your bot on a server you have administrative access to. For documentation, you can read: https://discordapp.com/developers/docs/topics/oauth2#bots. The steps are as follows:

    1. Go to https://discordapp.com/api/oauth2/authorize?client_id=[CLIENT ID]&permissions=3197953&scope=bot where [CLIENT_ID] is the Discord App Client ID
    2. Select Add a bot to a server and select the server to add it to
    3. Click Authorize
    4. You should now see your bot in your server listed as Offline.

If want want to use Docker, just go to the Docker section.

  1. To bring your bot Online, navigate to the root of the app (where index.js is located) and in your console, type node index.js
    • This will start your server. The console will need to be running for the bot to run.

If I am missing any steps, feel free to reach out or open an issue/bug in the Issues for this repository.


Docker

If you are using Docker, you can use these commands to build and start your Plex bot (after downloading the source code and set the config file) :

go to your plex bot folder (cd your/plex/bot/folder)

docker build -t image/plexbot .

docker run -p 32400 -d --name plexbot image/plexbot

wait a few seconds and your bot should join your server and be active. You can use docker logs plexbot to see the log of the bot (use docker logs -f plexbot if you want realtime log).

Note : you may need the sudo command/admin access depending of your user right.

Usage

  1. Join a Discord voice channel.
  2. Upon playing a song, the bot will join your channel and play your desired song.

Some Commands

  • !? : print all of the available commands.
  • !plexTest : a test to see make sure your Plex server is connected properly.
  • !clearqueue : clears all songs in queue.
  • !nextpage : get next page of songs if desired song is not listed.
  • !pause : pauses current song if one is playing.
  • !play <song title or artist> : bot will join voice channel and play song if one song available. if more than one, bot will return a list to choose from.
  • !playsong <song number> : plays a song from the generated song list.
  • !removesong <song queue number> : removes song by index from the song queue.
  • !resume : resumes song if previously paused.
  • !skip : skips the current song if one is playing and plays the next song in queue if it exists.
  • !stop : stops song if one is playing.
  • !viewqueue : displays current song queue.
  • !playlist ? : displays all the playlist related commands.

Customization

Update the config\keys.js file with your information:

module.exports = {
  'botToken'      : 'DISCORD_BOT_TOKEN',
};

And update the config\plex.js file with your Plex information:

module.exports= {
  'hostname'    : 'PLEX_LOCAL_IP',
  'port'        : 'PLEX_LOCAL_PORT',
  'https'       : false,
  'token'       : 'PLEX_TOKEN',
  'managedUser' : 'PLEX_MANAGED_USERNAME',
  'options'     : {
    'identifier': 'APP_IDENTIFIER',
    'product'   : 'APP_PRODUCT_NAME',
    'version'   : 'APP_VERSION_NUMBER',
    'deviceName': 'APP_DEVICE_NAME',
    'platform'  : 'Discord',
    'device'    : 'Discord'
  }
};

You can find us on Discord : https://discord.gg/c39aRhB Join it if you want to discuss or have any suggestions.

If you see any bugs use the issue tracker. Thanks!


To Do:

  • ????

## Completed:
* [x] youtube command.
* [x] refactor the code base.
* [x] add language support.
* [x] plex mood support.
* [x] plex playlist support.
* [x] plex artist support.
* [x] shuffle and loop support.

plex-discord-bot_v2's People

Contributors

irbyk avatar leukosaima avatar dependabot[bot] avatar hackmonker avatar adelick avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.