Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
dgh-package
Advanced tools
A Node.JS Discord bot that takes song requests from videos on YouTube, queues them and plays the audio of said videos on a voice channel.
I made it totally ad-hoc for my personal server so it doesn't support multiple servers for a single instance or anything like that, but it can be customised very easily to make it work on any server you want.
!remove last
will delete the last request that was added.Obviously, you must install Node.JS if you haven't already. Any version above 6.0.0 should do. It's highly recommended that you run the server on a Linux environment, because some dependencies will probably complain if you try to install them on Windows.
Then, install the bot itself. Just open up a console, type npm install discord-music-bot
and you're done. It should be fairly quick and painless.
Next, register a new Discord application for your own instance of the bot. Keep track of the Client ID and your token.
It's time to make the bot join your server: replace your Client ID on this URL and navigate to it https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=0
. Select the server you want the bot to join and click Authorize. This step requires that you have manage permissions on the server, otherwise it will not appear in the server list you'll be prompted with. Your bot should now appear as Offline in your server.
Finally, let's bring it to life! It's as simple as executing this script:
var bot = require("discord-music-bot");
var serverName = "Your server name here";
var textChannelName = "Your text channel name here (without #)";
var voiceChannelName = "Your voice channel name here";
var aliasesFile = "A file the bot will use to store your aliases";
var botToken = "Your bot token here";
bot.run(serverName, textChannelName, voiceChannelName, aliasesFile, botToken);
The aliases file parameter can be just a filename or a path to a file. If it does not exist, it will be generated. If you provide a filename, it will be generated in the same folder as the previous script. Any filename will do.
The bot will join the voice channel that you configured when it connects to the server, but obviously you can move it to other voice channels once it joins. The text channel is the one the bot will use to listen to commands and announce stuff. Keep in mind that all names are case-sensitive!
Save it with whatever name you want (for instance, "bot.js") and then execute it using Node.JS: node bot.js
. Your bot should now be up and running in your server!
In order to use the !search command, you must provide the bot with a YouTube API key of your own. The process is quite simple:
bot.setYoutubeKey("place your API key here");
FAQs
Simple dgh bot for Discord servers.
The npm package dgh-package receives a total of 0 weekly downloads. As such, dgh-package popularity was classified as not popular.
We found that dgh-package demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.