A sample Discord bot that send messages and plays sounds. Built using discord.js.
autoLeaveVoice
- When set to true
, the bot will leave after playing a sound. The sound of a bot joining/leaving a voice channel can be annoying, so by setting this to false, the bot will stay in the voice channel until told to leave by the !bot exit
command.
autoLoadSounds
- When set to true
, the bot will attempt to load in every file placed in the sounds
directory. To generate the sound's command, soundCommandTrigger
is prepended, the audio extension is stripped off, and hyphens are converted to spaces.
For example, nasa-smallstep.mp3
would be activated by !nasa smallstep
.
commands.set(<regexp>, array[type, reply])
- regexp
is what your bot will match messages against, regular expressions are used here mainly to make things case-insensitive. type
can currently be function
, sound
, or text
, but can be extended further if your bot requires additional functionality.
- Clone this repository
- After completing the prerequisites, run
npm install
on this project making sure nothing fails, particularlynode-opus
- Open
index.js
and add your bot'sToken
where it saysAPP_BOT_USER_TOKEN
- Authorize your bot using this URL
https://discordapp.com/oauth2/authorize?client_id=APPLICATION_ID&scope=bot&permissions=0
where APPLICATION_ID is yourApplication ID
and add it to a server you manage. - Run
node index.js
from the project and typeliftoff
into the Discord server chat or type !smallstep while connected to a voice channel on the server.
- Everything from the discord.js documentation, which generally includes
- Your operating system's developer tools
- Node.js
- ffmpeg installed and on your PATH
- Create a new Discord application
- Navigate to your Discord applications
- Create a new application and keep its
Application ID
handy - Create a bot user and keep its
Token
handy
I created this bot as a good jumping off point for what most bot makers will want their bots to do. If something about it is confusing, please submit a PR.
- Michael Deeb - Initial work - michaeljdeeb
See also the list of contributors who participated in this project.
This project is licensed under the ISC License - see the LICENSE file for details
- Discord
- discord.js
- NASA for the sample sound used by the bot.