logo TopazBot - RTSP Discord Music bot for TopazChat

Lint/Format Node.js CI CircleCI codecov TypeScript Node.js Discord License: MIT

Screenshot

ๆ—ฅๆœฌ่ชžREADME


๐ŸŒŸ Overview

TopazBot is a high-quality, low-latency Discord music bot that utilizes TopazChatโ€™s RTSP stream. It runs on servers like Linux and provides streamed audio to your Discord server.

Attention!!

โ€œTopazBotโ€ is under the MIT license, but โ€œTopazChatโ€ is not for commercial use.

โœจ Key Features


๐Ÿ’Ž About TopazChat

๐Ÿ“ Details

TopazChat is a high-quality, low-latency RTSP server. It is free for personal use.

TopazChat Download

The costs for TopazChat are covered by the developer, Hirotoshi Yoshitaka @TyounanMOTI.

Please consider donating to help with server maintenance and data transfer costs for audio/video streaming! โ†’ FANBOX

All sponsors of TopazChat are listed in SPONSORS.txt.

๐Ÿ’ฌ Community

Join: https://discord.com/invite/fCMcJ8A


๐Ÿš€ Quick Start

There are two ways to get started with TopazBot.

1. Use the Public Bot

This is the easiest way. You can add the bot to your Discord server using the link below:

Click here to add the bot

2. Self-Hosting

You can host the bot on your own server.

๐Ÿ“‹ Prerequisites

๐Ÿ“ฆ Dependencies

This library requires one dependency from each of the categories below to support various platforms.

The dependencies are listed in order of performance preference.

If you cannot install one of the options, try installing another.

๐Ÿง Debian or Ubuntu

node & npm:

discord.js (npm install)

@discordjs/voice (npm install):

@discordjs/opus (npm install):

Encryption Libraries (npm install):

Opus Libraries (npm install):

FFmpeg:

pm2 (npm install): [Optional]

๐Ÿ› ๏ธ Installation

# Clone the repository
git clone https://github.com/emerauda/TopazBot.git topazbot
cd topazbot

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit the .env file and set the required environment variables

โš™๏ธ Configuration

Set the following environment variable in your .env file:

DISCORD_TOKEN=your_discord_bot_token

๐Ÿš€ Deployment

# Build
npm run build

# Start
npm run start

# Register commands
npm run register

# Start the program using pm2
npm i pm2 -g
pm2 start npm -n TopazBot -- start

๐ŸŽฎ Command List

TopazBot supports the following slash commands.

โ–ถ๏ธ /play

๐Ÿ”„ /resync

โน๏ธ /stop



๐Ÿ—๏ธ Architecture

graph TD
    subgraph "Discord Server"
        User
        DiscordVoiceChannel[Discord Voice Channel]
    end

    subgraph "Your Server (VPS)"
        TopazBot
        FFmpeg
    end

    subgraph "TopazChat Server"
        TopazChat
    end

    User -- "/play" --> TopazBot
    TopazBot -- "RTSP Stream Request" --> TopazChat
    TopazChat -- "RTSP Stream" --> FFmpeg
    FFmpeg -- "Opus Audio" --> TopazBot
    TopazBot -- "Sends Audio" --> DiscordVoiceChannel

๐Ÿ”ง Tech Stack

Category Technology Version
Language TypeScript ^5.8.3
Runtime Node.js >=22.x
Framework discord.js ^14.21.0
Audio Processing @discordjs/voice ^0.18.0
Media Processing FFmpeg -
RTSP Server TopazChat -
Opus Library @discordjs/opus ^0.10.0
Encryption sodium-native ^5.0.6
Package Manager npm >=6
Testing Jest ^30.0.3
Linter ESLint ^9.30.1
Formatter Prettier ^3.6.2

๐Ÿงช Development

๐Ÿ“ Scripts

Command Description
npm run build Build TypeScript
npm run dev Start development server
npm run register Register Discord commands
npm run lint Run type checking
npm run lint:fix Run type fixing
npm run format Apply code formatting
npm run format:check Check code formatting
npm run test Run tests
npm run test:watch Run tests in watch mode
npm run test:coverage Run tests with coverage

๐Ÿ” Debugging

# Start local development server
npm run dev

# Run tests
npm test

# Generate coverage report
npm run test:coverage

The coverage report can be viewed at coverage


๐Ÿ“‚ Code structure

The code for this bot is specific to TopazChat.

Here is the code I used for reference: discordjs-japan/Playing Audio (in Japanese)

Created by Discord.js Japan user Group


๐Ÿค Contributing to TopazBot

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag โ€œenhancementโ€. Donโ€™t forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please read our Contributing Guidelines for more details on the process and what we expect.


โค๏ธ Donations

๐Ÿ“ป TopazBot

Please consider donating to help maintain the public TopazBot server.

๐Ÿ’Ž TopazChat

The developer of TopazChat, Hirotoshi Yoshitaka, is seeking donations to cover server maintenance and data transfer costs.

๐Ÿ™ Credits

๐Ÿ“ป TopazBot

๐Ÿ’Ž TopazChat

๐Ÿ“„ License

This project is released under the MIT License. See the LICENSE file for details.


๐Ÿ‘ฅ Team

Contributors


๐Ÿ“ž Support


๐ŸŒŸ Star History

Star History Chart


๐Ÿ“Š Statistics

GitHub Stats


โญ If you like this project, please give it a star! โญ

GitHub stars GitHub forks GitHub watchers

Made with โค๏ธ by Aoi Emerauda