Streams any YouTube video to your private Discord server. A simple bot using LavaPlayer and Discord4J.
- Amazon Coretto (https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html)
- Add Java to classpath such that the command
java --versionresolves to >= 17.
- Create your Discord Application in the Developer Portal. (https://discord.com/developers/applications)
- Obtain Client Secret from the "Bot" tab.
- Obtain Application ID and Public Key from the "General Information" tab.
- Obtain the Guild ID of your Discord Guild.
- Obtain the Channel ID of your requests channel.
Hint: Find the guild and channel ID easily by using the Discord browser client. Example: https://discord.com/channels/<guild_id>/<channel_id>
- Create file
application-local.ymlinsrc/main/resources(gitignored for this purpose) - Set the following properties:
discord: authentication: public: request-channel-id: <channel id where music requests are allowed> app-id: <your discord application ID> guild-id: <your discord guild ID> public-key: <your application public key> secret: discord-token: <your SUPER secret discord token here>
- Run Spring with the
localprofile to load your special property file. Use the following command in the repository's root directory.# Linux / Mac / Git Bash ./gradlew bootRun --args='--spring.profiles.active=local' # Windows Command Prompt gradlew bootRun --args='--spring.profiles.active=local'
The first time you run the application, you'll see a log message instructing you to log into YouTube.
Follow the link and this will generate an "OAuth Refresh Token"; YouTube will now associate
your account with that token. Once you have the refresh token, set the following property in your application-local.yml.
discord:
authentication:
secret:
oauth-2-token: <your SUPER secret YouTube OAuth Token here>Hint: USE A BURNER ACCOUNT. Do not use your main Google account. This bot is against YouTube ToS; if they catch you, they can terminate your account.
Now, whenever the bot launches, it will handle YouTube login automatically, no action required from the user.
When you launch the application, it will automatically install all commands on your server.