Skip to content

mrjackyliang/discord-audio-stream-bot

Repository files navigation

Discord Audio Stream Bot

GitHub Releases GitHub Top Languages GitHub License Become a GitHub Sponsor Donate via PayPal

A small utility that captures audio from a local source and broadcasts it to a Discord server. DASBot requires several dependencies and has been developed and tested on macOS.

To use this Discord bot, you would need to:

  1. Install the dependencies
  2. Configure this bot to use your Discord bot token
  3. Begin to stream audio on Discord

Install Dependencies

Before we configure and run DASBot, you would require NodeJS, FFmpeg, and a virtual device driver such as Rogue Amoeba's Loopback. Follow the directions below to get started.

  1. Install Homebrew to run the commands below
  2. Install FFmpeg by running brew install ffmpeg
  3. Install NodeJS by running brew install node
  4. Tap into the DASBot directory with cd discord-audio-stream-bot
  5. Install project dependencies by runningnpm install

Configure Loopback Device

If you have not installed Rogue Amoeba's Loopback, now is the time to do so. The instructions below assumes that you have already installed and opened the application. Spotify will be used in this example.

Rogue Amoeba's Loopback with Spotify Audio

  1. In the bottom left corner, click New Virtual Device
  2. With Loopback Audio highlighted, rename the device to Spotify
  3. Click on the Pass-Thru source, and then Delete
  4. To the right of Sources, click + > Select Application...
  5. Select Spotify and then click Open

Configure Application

Below are the instructions on how you can create a Discord bot and add the Discord bot into your server. Once that is done, we will proceed to configure the connection between DASBot and the Discord bot.

  1. First go to the Discord Developer Portal
  2. In the top right corner, click New Application
  3. Under the Name field, type "DASBot"
  4. When the application is created, click the Bot menu item
  5. Click Add Bot and then click Yes, do it!
  6. Click the General Information menu item
  7. Under Client ID, click Copy
  8. Replace the CLIENT_ID_HERE below and visit link:
    • https://discord.com/oauth2/authorize?client_id=CLIENT_ID_HERE&scope=bot&permissions=36719872

Configure the Discord Bot Token

The project includes a .env.sample file. An .env file will be created here. The instructions below assumes you are still inside the discord-audio-stream-bot directory.

  1. Create a .env file using the contents of .env.sample by running cp .env.sample .env
  2. Go to the Discord Developer Portal and click the Bot menu item
  3. Under Token, click Copy to copy the Discord bot token
  4. Open the .env file and replace YOUR_DISCORD_CLIENT_TOKEN_HERE with the token

Launch the DASBot

Once the final configuration is completed, it is now time to launch the bot. The instructions below assumes you are still inside the discord-audio-stream-bot directory.

Terminal running DASBot

  1. Start off by typing npm start to start DASBot
  2. Using the arrow keys, select Spotify, then press Return (or Enter)
  3. When you see Server is ready ..., open Discord
  4. In Discord, type @DASBot, and then DASBot will respond