- Install Node.js: https://nodejs.org/
- If using Windows, I generally install Cmder as a console emulator to avoid issues: http://cmder.net/
- Clone the repo or download a zip and unpackage it.
- Navigate to the root folder and in the console, type
npm install
- You should see packages beginning to install
- Once this is complete, go here: https://discordapp.com/developers/applications/me
- Log in or create an account
- Click New App
- Fill in App Name and anything else you'd like to include
- Click Create App
- This will provide you with your Client ID and Client Secret
- Click Create Bot User
- This will provide you with your bot Username and Token
- Take all of the information from the page and enter it into the
config/keys.js
file, replacing the placeholders. - Navigate to the
config/plex.js
file and replace the placeholders with your Plex Server information- To get your token, following the instructions here: https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token
- The identifier, product, version, and deviceName can be anything you want
- 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:
- Go to
https://discordapp.com/api/oauth2/authorize?client_id=[CLIENT_ID]&scope=bot&permissions=1
where [CLIENT_ID] is the Discord App Client ID - Select Add a bot to a server and select the server to add it to
- Click Authorize
- You should now see your bot in your server listed as Offline
- Go to
- To bring your bot Online, navigate to the root of the app (where
index.js
is located) and in your console, typenode 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.
- Join a Discord voice channel.
- Upon playing a song, the bot will join your channel and play your desired song.
!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!bot prefix <prefix>
: changes the bot prefix for the guild
Update the config\keys.js
file with your information:
module.exports = {
'botToken' : 'DISCORD_BOT_TOKEN',
'defaultPrefix' : '!'
};
And update the config\plex.js
file with your Plex information:
module.exports= {
'hostname' : 'PLEX_LOCAL_IP',
'port' : 'PLEX_LOCAL_PORT',
'username' : 'PLEX_USERNAME',
'password' : 'PLEX_PASSWORD',
'token' : 'PLEX_TOKEN',
'options' : {
'identifier': 'Plex-Discord-Bot',
'product' : 'Node.js App',
'version' : '1.0.0',
'deviceName': 'Node.js App',
'platform' : 'Discord',
'device' : 'Discord'
}
};
If you see any bugs or have any suggestions, use the issue tracker. Thanks!
- Make !nextpage count continue to increase rather than restarting each page
- move to next gen javascript w/babel
- use uri/headers for plex.query as shown here:
return api.query({ uri: '/', extraHeaders: { 'X-TEST-HEADER': 'X-TEST-HEADER-VAL' } }).then(result => {
expect(result).to.be.an('object');
nockServer.done();
});
- handle case where user types
!play
when another song is playing - make code look less shitty
- fix !stop again
- make playlists