Present Mic is a My Hero Academia inspired Discord music bot built on Node.js 16 and uses Discord.js v13 to interface with the Discord API.
Click here to invite the bot to your server. This bot is not yet verified to run in 100 or more servers.
play [query]: Search YouTube forqueryand queue up the first result found. Direct YouTube video and playlist links are supported.search [query]: Search YouTube forqueryand select results to queue upremove [positions]: Remove items in the queue at the specified positions.positionsmust be a comma-separated list of either a specific position or inclusive range (ex:4, 8-12, 16, 20-24).move [position] [new_position]: Moves items atpositiontonew_position.positioncan be a range butnew_positioncannot (ex:8-12, 4).loop: Enable or disable loopingskip: Skip the now playing itemclear: Remove all items from the queue and stop playbackqueue: Display the queuedisconnect: Disconnect the bot from the voice channelinvite: Generate a link to invite the bot to a servernerd: Output version and generate a dependency report of audio-relevant technologies
- Make sure you have installed Node.js v16 or higher, Git and ffmpeg.
- Create a Discord bot application. Please see the Environment Variables section to know how to store your bot's token and client ID.
- Obtain access to Google's YouTube Data API v3. Follow the first three steps in the Before You Start section of this guide and please be sure to create an API Key instead of an OAuth 2.0 token.
- Clone this repository with
git clone https://github.com/tochiu/discord-present-mic - Run
cd discord-present-micto move in the folder that Git has just created. - Run
npm install. If you are on Windows please follow the Caveat for Windows section first before running this command.
Extra steps must be taken for hosting on Windows to ensure the sodium encryption library builds properly.
- Make sure Build Tools 2015 are installed.
- Install the Windows 8.1 SDK (it appears the
node-addon-apimodulesodiumis dependent on requires this). Microsoft maintains an archive of their SDKs here. - In your Windows environment variables, add
VCTargetsPathand set it toC:\Program Files (x86)\MSBuild\Microsoft.cpp\v4.0\v140 - Run
npm config set msvs_version 2015 - Run
npm installto verify success
If sodium continues to fail then run npm uninstall sodium followed with npm i libsodium-wrappers. This is an alternative encryption library.
If you don't already have a method of pushing environment variables to this application then you should run npm i dotenv and create a .env file in the project's root folder. Each line in a .env file should hold a KEY=value pair.
The following environment variables are required:
PERMISSIONS_INT: Set this to274914692096. This represents the permissions the bot needs from Discord to function.CLIENT_ID: This is the ID of the bot and is found in your bot's application.TOKEN: This is what is required to log into a Discord bot. This is also found in your bot's application. This is very sensitive information and cannot be disclosed to anyone.GAPI_KEY_0,GAPI_KEY_1,GAPI_KEY_2, ... : This are the API keys used to access Google's YouTube Data API v3. If multiple API keys are supplied then they will be used in a randomized rotating order. This is only useful if each API key consumes separate qoutas.
Invite your self-hosted bot to servers with https://discord.com/api/oauth2/authorize?client_id=[CLIENT_ID]&permissions=[PERMISSIONS_INT]&scope=bot%20applications.commands. The CLIENT_ID and PERMISSIONS_INT are the same values you configured your environment variables to.
In order to spin up the bot, run npm start. Enjoy!