Skip to content

Commit

Permalink
organised docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LakhindarPal committed Jun 30, 2024
1 parent 13834f7 commit b7ba649
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 116 deletions.
7 changes: 5 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ Dockerfile
.dockerignore

# Documentation and metadata files
docs
previews
README.md
COMMANDS.md
CONTRIBUTING.md
LICENSE
SECURITY.md

# Scripts
scripts

# Configuration files
.editorconfig
.prettierignore
Expand Down
128 changes: 23 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,126 +17,44 @@ It is a Discord music bot built using [discord-player](https://npm.im/discord-pl

## Table of Contents

- [Features](#features)
- [Disclaimer](#disclaimer)
- [Installation](#installation)
- [Before you start](#before-you-start)
- [Config](#config)
- [Local Installation](#local-installation)
- [Docker Installation](#docker-installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [Features](#features)
- [Docs](docs/README.md):
- [Commands](docs/COMMANDS.md)
- [Installation](docs/INSTALLATION.md)
- [Prerequisites](docs/INSTALLATION.md#prerequisites)
- [Configuration](docs/INSTALLATION.md#configuration)
- [Local Installation](docs/INSTALLATION.md#local-installation)
- [Docker Installation](docs/INSTALLATION.md#docker-installation)
- [Contributing](docs/CONTRIBUTING.md)
- [License](#license)
- [Help](#help)
- [Feedback](#feedback)
- [Star History](#star-history)
- [Supporters](#supporters)

## Features

- **Beginner-Friendly**: Designed with simplicity in mind, making it easy for users of all skill levels to understand and use.
- **Quick Setup**: Get the bot up and running swiftly with straightforward installation instructions and minimal configuration requirements.
- **Versatile Commands**: A comprehensive range of commands to cater to various music playback needs, ensuring an enjoyable listening experience for all users.
- **Audio Filters**: Customize your listening experience with 25 FFmpeg filters, 18 Equalizer presets, and 10 Biquad filters.
- **Multi-Guild Support**: Effortlessly manage the bot across multiple Discord guilds, providing flexibility for diverse communities.
- **Various Sources**: Play music from a wide range of sources, including YouTube, Spotify, SoundCloud, Apple Music, Reverbnation, Deezer, Tidal, and more.
- **Slash Commands**: Take advantage of slash commands for seamless interaction with the bot, enhancing user experience and accessibility.

## Disclaimer

This project is intended for educational and entertainment purposes only. It is not designed to encourage or facilitate any form of unfair usage. If you represent a supported streaming platform and have concerns about the bot's functionality, please reach out to us via GitHub Discussions or our support channels for a constructive dialogue.

## Installation

### Before You Start

Before diving into the setup process, ensure you have the following prerequisites:

- **Discord Token** A Discord application with a bot token. You can create one by following the [Discord Developer Portal](https://discord.com/developers/applications) guide.

- **Node.js**: Version 20 or higher is required. If you haven't already installed Node.js, you can download it from the [official website](https://nodejs.org/en/download/).
- **NPM**: A package manager is required. NPM comes bundled with Node.js, so no separate installation is required.
- **FFmpeg or Avconv**: Ensure you have FFmpeg or Avconv installed for media transcoding. You can download (recommended) FFmpeg from the [official website](https://ffmpeg.org/download.html) or install it via npm `npm i ffmpeg-static`.

### Config

To configure the Discord Player Bot, you'll need to set up environment variables in a `.env` file. Here's how to do it:

1. **Create `.env` File**: In the root directory of the cloned repository, create a new file named `.env`.

2. **Use `.env.sample` as Template**: Open the `.env.sample` file provided in the repository. This file contains a template with placeholders for environment variables.

3. **Fill in Environment Variables**: Replace the placeholder values in the `.env.sample` file with your actual values. Refer to the comments in the file for guidance on each variable.

4. **Save as `.env`**: After filling in the environment variables, save the file as `.env` in the same directory. This file will be used by the bot to load configuration during runtime.

5. **Review Configuration**: Double-check the configuration in the `.env` file to ensure that all necessary variables are properly set.

By following these steps and customizing the `.env` file with your specific configuration, you can effectively set up the Discord Player Bot according to your requirements.

### Local Installation
This project is not affiliated with Discord or any streaming platforms. It is intended for educational and entertainment purposes only. It is not designed to encourage or facilitate any form of unfair usage. If you represent a supported streaming platform and have concerns about the bot's functionality, please reach out to us via GitHub Discussions or our support channels for a constructive dialogue.

1. **Fill the `.env` File**: Ensure that you have filled out the necessary environment variables in the `.env` file as described above.

2. **Install Dependencies**: Install the required dependencies by running the following command in the project directory:

```bash
npm install
```

3. **Register Slash Commands**: If you are using this bot for the first time or have added new commands, you need to register the slash commands with Discord. Run the following command:

```bash
npm run register
```

This will register all the slash commands defined in your project with Discord. You should see a message indicating the number of commands registered.

4. **Run the Bot**: Start the bot by running:

```bash
npm start
```

This will launch the bot, and it will connect to Discord using the provided token.

### Docker Installation

If you prefer to use Docker for deploying the Discord Player Bot, follow these steps:

1. **Fill the `.env` File**: Ensure that you have filled out the necessary environment variables in the `.env` file as described above.

2. **Pull Docker Image**: Run the following command in terminal:

```bash
docker pull lakhindarpal/discord-player-bot:latest
```

This command will pull the latest image of discord-player-bot from docker hub.

3. **Run Docker Container**: Once the Docker image is pulled successfully, you can run the Docker container using the following command:

```bash
docker run --env-file .env lakhindarpal/discord-player-bot:latest
```

4. **Enjoy Dockerized Discord Player Bot**: Your Discord Player Bot should now be running in a Docker container, ready to provide music playback functionality in your Discord server.
## Features

By following these steps, you can deploy the Discord Player Bot using Docker, providing a convenient and isolated environment for running the bot.
- **Beginner-Friendly**: Easy to use for all skill levels.
- **Quick Setup**: Simple docker installation with minimal configuration.
- **Various Sources**: Stream music from YouTube, Spotify, SoundCloud, Apple Music, Deezer, Tidal, and more.
- **Audio Filters**: Customize audio with 25 FFmpeg filters, 18 equalizer presets, and 10 biquad filters.
- **Button Control**: Intuitive buttons for easy music control.
- **Slash Commands**: Seamless interaction through intuitive slash commands.
- **Versatile Commands**: Extensive range of music playback commands.
- **Multi-Guild Support**: Manage the bot across multiple Discord servers.

## Usage
## Previews

Once the bot is running and added to your Discord server, you can use the features it provides.
For detailed command usage and examples, please refer to the [Commands](./COMMANDS.md) documentation.
![Play Song](previews/play_song.png)

## Contributing
## Docs

1. [Fork the repo](https://github.com/LakhindarPal/discord-player-bot/fork)
2. Install the dependencies (`npm install`)
3. Create the feature branch (`git checkout -b my-cool-feature`)
4. Commit your changes (`git commit -m "Added a cool new feature!"`)
5. Push to your branch (`git push origin my-cool-feature`)
6. [Open a pull request](https://github.com/LakhindarPal/discord-player-bot/pulls)
[View docs](docs/README.md)

## License

Expand Down
Binary file modified bun.lockb
Binary file not shown.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Installation

## Prerequisites

Ensure you have the following before setup:

- **Discord Token**: Obtain from the [Discord Developer Portal](https://discord.com/developers/applications).
- **Node.js**: Version 20 or higher. Download [here](https://nodejs.org/en/download/).
- **NPM**: Comes with Node.js.
- **FFmpeg or Avconv**: Required for media transcoding. Download [FFmpeg](https://ffmpeg.org/download.html) or install via npm: `npm i ffmpeg-static`

## Configuration

1. **DISCORD_TOKEN**: Bot token for Discord API.
2. **CLIENT_ID**: Bot application ID to register slash commands.
3. **DEV_GUILD**: ID of the development server.
4. **DEV_IDS**: Comma-separated list of developer IDs.
5. **SUPPORT_SERVER**: Link to the discord support server.

### Setup Steps

1. **Create `.env` File**: In the root directory, create `.env`.
2. **Use `.env.sample`**: Copy and replace placeholders with your values.
3. **Save as `.env`**: Ensure all variables are correctly filled.

## Local Installation

1. **Clone the Repository**: `git clone https://github.com/LakhindarPal/discord-player-bot && cd discord-player-bot`
2. **Install Dependencies**: `npm install`
3. **Fill the `.env` File**: Ensure all configurations are set as describe above.
4. **Register Slash Commands**: `npm run register`
5. **Run the Bot**: `npm start`

## Docker Installation

1. **Fill the `.env` File**: Ensure all configurations are set as described above.
2. **Pull Docker Image**: `docker pull lakhindarpal/discord-player-bot:latest`
3. **Run Docker Container**: `docker run --env-file .env lakhindarpal/discord-player-bot:latest`
4. **Register Slash Commands**: `docker exec -it <container_id> npm run register`
20 changes: 20 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Docs

## Index

- [Commands](COMMANDS.md)
- [Installation](INSTALLATION.md)
- [Prerequisites](INSTALLATION.md#prerequisites)
- [Configuration](INSTALLATION.md#configuration)
- [Local Installation](INSTALLATION.md#local-installation)
- [Docker Installation](INSTALLATION.md#docker-installation)
- [Contributing](CONTRIBUTING.md)

## Links

[![Docker Hub](https://img.shields.io/badge/Docker-Hub-blue?style=for-the-badge&logo=docker)](https://hub.docker.com/r/lakhindarpal/discord-player-bot)
[![Support](https://img.shields.io/badge/Discord-Support-blue?style=for-the-badge&logo=discord)](https://discord.gg/8yaJBZBQTA)

---

[Return to index](../README.md)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "discord-player-bot",
"version": "3.3.0",
"version": "3.3.1",
"description": "A discord music bot built using discord.js and discord-player",
"main": "src/index.js",
"type": "module",
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier . --write",
"register": "node src/scripts/register.js",
"doc": "node src/scripts/cmd-doc.js",
"doc": "node scripts/cmd-doc.js",
"build": "docker build -t lakhindarpal/discord-player-bot:latest .",
"run": "docker run --env-file .env lakhindarpal/discord-player-bot:latest",
"register": "node scripts/register.js",
"start": "node .",
"dev": "node --watch-path=./src ."
},
Expand Down
Binary file added previews/play_song.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/scripts/cmd-doc.js → scripts/cmd-doc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import { Collection } from "discord.js";
import { loadCommands } from "../handlers/command.js";
import { titleCase } from "../modules/utils.js";
import { loadCommands } from "../src//handlers/command.js";
import { titleCase } from "../src/modules/utils.js";

const OPTION_TYPE_MAP = {
1: "Subcommand",
Expand Down Expand Up @@ -90,7 +90,7 @@ async function generateMarkdown() {

const content = generateContent(fakeClient.commands);

fs.writeFileSync("COMMANDS.md", content);
fs.writeFileSync("docs/COMMANDS.md", content);
console.log("COMMANDS.md has been generated.");
} catch (error) {
console.error("An error occurred:", error);
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/register.js → scripts/register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "dotenv/config";
import { Collection, REST, Routes } from "discord.js";
import { loadCommands } from "../handlers/command.js";
import { loadCommands } from "../src/handlers/command.js";

// check env variables
const envVariables = ["DISCORD_TOKEN", "CLIENT_ID", "DEV_GUILD"];
Expand Down

0 comments on commit b7ba649

Please sign in to comment.