Skip to content

ROZ-MOFUMOFU-ME/TopazBot

Repository files navigation

TopazBot - RTSP Discord Music bot for TopazChat

Join the chat at https://github.com/ROZ-MOFUMOFU-ME/TopazBot/ Node.js CI CircleCI

スクリーンショット 2023年-05月-13日 21 36 27

日本語README

Community

  • TopazChat Discord Server

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

About

A TopazChat RTSP specific implementation of the Discord Voice API for Node.js, written in JavaScript.

Attention!!

TopazBot is under the MIT license, but TopazChat is not for commercial use.

Features:

Send and receive* audio in Discord voice-based channels A strong focus on reliability and predictable behaviour Horizontal scalability and libraries other than discord.js are supported with custom adapters A robust audio processing system that can handle a wide range of audio sources

About TopazChat:

TopazChat is a high quality, low latency RTSP server. It is free for personal use. TopazChat Download TopazChat's costs is paid by the author Hirotoshi Yoshitaka @TyounanMOTI, to maintain the instance and audio and video stream data transfer. Please make a donation at FANBOX!. All sponsors of TopazChat are listed in the SPONSORS.txt.

Useful links:

Dependencies

This library has several optional dependencies to support a variety of different platforms. Install one dependency from each of the categories shown below. The dependencies are listed in order of preference for performance. If you can't install one of the options, try installing another.

Debian or Ubuntu

node & npm:

  • node: >=16
  • npm: >=6

discord.js:

  • discord.js: ^13.0.0

@discordjs/voice:

  • @discordjs/voice: ^0.6.0

Encryption Libraries (npm install):

  • sodium: ^3.0.2

Opus Libraries (npm install):

  • @discordjs/opus: ^0.6.0

FFmpeg:

  • FFmpeg (installed and added to environment)
  • ffmpeg-static: ^4.2.7 (npm install)

pm2 (npm install): [Optional]

  • pm2

TopazBot Example

This is an example of how to create a TopazBot using @discordjs/voice alongside discord.js.

The focus of this example is on how to create a robust music system using this library.

The example explores error recovery, reconnection logic and implementation of a queue that won't lock up.

If you're looking to make your own TopazBot that is fairly simple, this example is a great place to start.

Usage

# for Debian/Ubuntu
# Clone the main repository
$ git clone https://github.com/ROZ-MOFUMOFU-ME/TopazBot topazbot

# Open this example and install dependencies
$ cd topazbot
$ npm install

# Set a bot token
$ vi config.json

# Regist command
$ node register.js

# Start the bot
$ npm start

# Start the bot with pm2
$ sudo npm i pm2 -g
$ pm2 start index.js --name TopazBot

# Summon TopazBot to your Discord Server
$ https://discord.com/api/oauth2/authorize?client_id=876143776572248074&permissions=3155968&scope=bot%20applications.commands

# Play music after join voice channel at Discord text field
$ /play StreamKey

# Resume stopped music when stream is restart
$ /resync

# Disconnect TopazBot from the voice channel
$ /stop

Code structure

The code for the bot is specific to TopazChat.

Here is the code I used for reference. @discordjs/voiceを使用して音声を再生する

Created by Discord.js Japan user Group

Contribution

See Contributing Guide.

Donations

Donations for development are greatly appreciated!

TopazBot

Please make a donation to help maintain the public TopazBot server.

TopazChat

TopazChat's author Hirotoshi Yoshitaka is asking for donations to cover the costs of maintaining the server and transferring data.

Credits

TopazBot

TopazChat

License

Released under the MIT License. See LICENSE file.