Git Product home page Git Product logo

discord-bot's Introduction

Discord Music bot

A simple discord bot that helps you manage your server by providing useful commands like playing music or deleting text messages.

You can find the tutorial about building a discord music bot here.

Table of content

Requirements

Getting started

First, make sure you have all the required tools installed on your local machine then continue with these steps.

Installation

# Clone the repository
git clone https://github.com/TannerGabriel/discord-bot.git

# Enter into the directory
cd discord-bot/

# Install the dependencies
npm install

Required permissions

Important: Make sure that your bot has the applications.commands application scope enabled, which can be found under the OAuth2 tap on the developer portal

Configuration

After cloning the project and installing all dependencies, you need to add your Discord API token in the config.json file.

Starting the application

node index.js

Starting the application using Docker

# Build the image
docker build --tag discordbot .

# Run the image
docker run -d discordbot

Deploying commands

Before you can use the bots slash command you first need to add them to your Discord server. You can use the !deploy command to do so.

After deploying the commands you should be able to see and access them by typing a slash:

Features & Commands

Note: The repository now uses the new Discord slash commands

  • ๐ŸŽถ Play music from YouTube via url

/play YOUTUBE_URL

  • ๐ŸŽถ Play music from using song name

/play SONG_NAME

  • ๐Ÿ“ƒ Pause music

/pause

  • ๐ŸŽ“ Resume music

/resume

  • ๐Ÿ’ฟ Skip song

/skip

  • ๐Ÿ”‡ Stop music

/stop

  • ๐Ÿ”€ Shuffle Queue

/shuffle

  • โ†• Move song position

/move TRACK_POSITION TARGET_POSITION

  • โ†”๏ธ Swap song positions

/swap POSITION_1 POSITION_2

  • โ๏ธ Remove song

/remove POSITION

  • Now Playing (/nowplaying)
  • Get information about a user (/userinfo USER)
  • Ban a player (/ban USER)
  • Delete the latest chat messages (/purge NUM_OF_MESSAGES)

Common errors

Here is a list of common errors and how you can fix them.

Dependencies aren't up to date

The packages used in this repository get updated often, especially the ytdl-core package. That is why it is always worth a try updating those if you get an error like invalid URL: undefined or when the bot crashes when running the play command.

npm install ytdl-core@latest

FFMPEG is not installed on the machine running the bot

The play command requires FFMPEG to be installed on the machine that is running the bot. You can download it on the official FFMPEG website. Note: This isn't relevant if you use the Dockerfile because it will install FFMPEG inside of the container.

Contributing

You are welcome to contribute by submitting a Pull Request to the repository.

Author

Gabriel Tanner

Support me

Buy Me A Coffee

License

This project is licensed under the MIT License - see the LICENSE.md file for details

discord-bot's People

Contributors

asdfugil avatar dependabot[bot] avatar hackmeany avatar loganheasman200 avatar paperback avatar protogendelta avatar renovate-bot avatar samdammers avatar smclean117 avatar tannergabriel avatar youwereout 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.