Giter Site home page Giter Site logo

discord-soundbot's Introduction

Discord Soundbot

A bot for Discord to play your favorite sounds or music. You can also add / rename / remove sounds, ignore certain users, and more!

This is a self-hosted bot which means that you have to install and start the bot yourself. This is due to the bot being heavily involved with voice functionality. But don't sweat it! You can find a thorough installation and configuration guide in this README!

If you still need any help after reading the guide, feel free to join my Discord server and shoot me a message.

Have fun!

Installation

General

To use this bot you first have to create your own Discord Application. Click on New App, enter a name for your app and press the Create App button on the bottom right. Now press on the button Create a Bot User for your bot token.

Now create a config.json file inside of the config folder according to the example. Enter the Client ID and the Token into the config. You can find both inside your Discord application under APP DETAILS and APP BOT USER respectively.

Building

The bot can be installed via Docker or manually.

Building via Docker

  • Simply clone the repo and run docker build -t soundbot . inside the folder.
  • Afterwards start the bot via docker run soundbot.
  • To run the container in the background use docker run -d soundbot.

Building manually

  • As per discord.js, Node.js v6.0.0 or newer is required.
  • Due to using voice functionality FFmpeg is required. Install it manually, or with npm install ffmpeg-binaries.
  • Install the bot's dependencies with npm install as usual.
  • Finally, run the bot with npm start.

Adding the bot to your server

In both cases the bot will print a message to your console which should look a little bit like this

Use the following URL to let the bot join your server!
https://discordapp.com/oauth2/authorize?client_id={YOUR_CLIENT_ID}&scope=bot

Follow the link and allow your bot to join one of your Discord servers.

Commands

Type !commands to print the following list of available commands.

!commands             Show this message
!sounds               Show available sounds
!tag <sound> <tag>    Add tag to sound
!search <tag>         Search for specific sound
!add                  Add the attached sound
!<sound>              Play the specified sound
!random               Play random sounds
!rename <old> <new>   Rename specified sound
!remove <sound>       Remove specified sound
!stop                 Stop playing and clear queue
!leave                Leave the channel
!mostplayed           Show 15 most used sounds
!lastadded            Show 5 last added sounds
!ignore <user>        Ignore specified user
!unignore <user>      Unignore specified user
!avatar [remove]       Set, show or remove the avatar

Adding sounds

You can add sounds to the bot by typing !add and attaching a file. Accepted file formats and a limit to the size are configurable. The name of the sound can only contain alphanumeric characters.

Playing sounds

Type !sounds to get a list of all sounds that are available to your bot. Play any sound by prefixing it with !, e.g. !rickroll. Play a random sound with !random.

All sounds will be added to a queue and played in succession. To halt the playback and empty the queue type !stop.

Tagging and searching sounds

When your library of sounds gets too big and you forget what kinds of sounds you have, you can add tags to sounds.

You can add tags to sounds with !tag <sound> <tag>. You can specify one or more sounds. You can get the tags of a sound with !tag <sound>. You can also remove all tags from a sound with !tag <sound> clear.

To search for specific sounds use !search <tag>. It will look for the name of the sound as well as tags that you might have added to the sound.

Renaming sounds

Sounds can be renamed by using !rename <old> <new>. The bot will respond with a status update.

Removing sounds

You can delete sounds by typing !remove <sound>. The bot will respond with the status of the deletion in the channel of the message.

Ignoring users

Users can be ignore from using any command by the !ignore <user> command while specifying their respective ID. The user will be mentioned by the bot in the channel of the message. Use !unignore <user> to allow the user to interact with the bot again.

Setting an avatar

Use !avatar and attach an image to set the bot's avatar. You can remove the avatar to go back to the default by using the optional remove parameter as in !avatar remove.

Restricted commands

The commands !rename, !remove, !ignore, !unignore, !avatar and !tag <sound> clear are restricted and can only be accessed by administrators.

Configuration

Check config/config.example.json for an example configuration and create a new file config.json with your desired configuration inside the config folder.

  • The bots prefix can be configured via prefix.
  • You can configure the accepted file formats (via the acceptedExtensions array) as well as the size of the accepted files (via the maxiumumFileSize given in bytes).
  • The bot can also automatically delete !<sound> messages for you to reduce channel spam. For this, set deleteMessages to true.
  • To let the bot stay in the channel after playing sounds to reduce noise, you can set the stayInChannel configuration option. You can order the bot to leave the channel with !leave.
  • You can set the bot's activity via the game options.

Contributing

This bot is a dear passion project of mine. If you have any suggestions for new features or improvements, feel free to open an issue. I'll be glad to look into it!

discord-soundbot's People

Contributors

kijz avatar markokajzer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.