A Discord audio bot that accept a list of youtube channel ID's to be streamed into you Discord chatroom/channels. This Discord bot is best ran in a Docker container, I've provided examples below.
- Create a new Application on discord by going to: https://discord.com/developers/applications/.
- Click on the Bot tab on the left, and Add a Bot.
- Copy the Bot's Token Key, this will be set as
DISCORD
environment variable. - Confirm
SERVER MEMBERS INTENT
is switched ON for the bot. - Copy your Bot's Client ID and visit the URL:
https://discord.com/oauth2/authorize?scope=bot&client_id=<CLIENT_ID_HERE>
. Be sure to replace<CLIENT_ID_HERE>
with your bot's client ID. This will authorize your bot to become a member of your channel. - Enable Developer Mode in the Discord app, and right click your Voice Chanel for the bot and click Copy ID, this will be used for
CHANNEL_ID
. - Right click your organization in Discord, and copy the Copy ID, this will be used for
GUILD_ID
. - Create a Youtube v3 API Key by going to Google API Console, create a new app, the Youtube API key will used for
YOUTUBE
. - Collect some Youtube Channel ID numbers from your favorite places. For example, Channel ID UCBOqkAGTtzZVmKvY4SwdZ2g.
You need to authenticate your bot to enter the channel by visiting a URL like below:
https://discord.com/oauth2/authorize?scope=bot&client_id=<CLIENT_ID>
Replace <CLIENT_ID>
with the bot's client ID number and authorize the bot.
YOUTUBE
: Found on Youtube's Credentials API pageDISCORD
: Discount bot client secret found on Discord's bot websiteCHANNELS
: A comma delimited list of Youtube ChannelsCHANNEL_ID
: The Discord chatroom/channel ID numberGUILD_ID
: The Discord organization ID number
discord_music:
container_name: discord_music
image: hunterlong/discord
restart: always
environment:
YOUTUBE: YOUTUBE_API_KEY
DISCORD: DISCORD_BOT_SECRET
CHANNELS: "UCw49uOTAJjGUdoAeUcp7tOg,UCw49uOTAJjGUdoAeUcp7tOg"
CHANNEL_ID: 7101030EXAMPLE735568
GUILD_ID: 7101EXAMPLE490182
volumes:
- discordaudio:/downloads:rw
You should have Golang installed, I recommend using the latest version. The follow the simple steps below:
go mod download
Download all go modulesgo build -o discord
Compile golang binary for your system's OS.- Enjoy.
MIT. PR's accepted if you want to.