Skip to content

Commit

Permalink
merge: all feature from byteblaze/next branch (#166)
Browse files Browse the repository at this point in the history
* add: base for /blacklist command (#101)

This commit will add the base for /blacklist command with raw string and not translated. Also this commit is not tested

* merge: latest update from main branch (#146)

* improve: logging system interface

* add: host option to bind into 0.0.0.0 ip address

* add: host option to config file

* add: spanish lang to ByteBlaze

* add: blacklist cmmand; merge: all filter command

This commit fill merge all filter command to 1 file to optimize and reduce code. Also this command introduce brand new command named blacklist to block user/guild rom using bot

* remove: file command due to lavalink restriction

* fix: 24/7 rejoin bug (#137)

* add: MAX Length for a song command (user wide, some command maynot work, #86)

* add: rewritten sharding system

* fix: sometimes bot leave server suddenly

* add: command sýtem for cluster to get mainstream data from primary cluster

* improve: code standard

* fix: build workflow failed

* fix: cluster crash

* remove: internal rainlink

* fix: build fail

* add: playerStop back

* update: all outdated package

* fix: cluster mode duplicate forks
remove: youtube download feature (#160)

* remove: some useless await
  • Loading branch information
RainyXeon authored Sep 7, 2024
1 parent 8d33e10 commit 73a85a6
Show file tree
Hide file tree
Showing 136 changed files with 384 additions and 7,370 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
![song_req](https://ucarecdn.com/25e8fc92-842d-40c2-a653-d1c0224804ae/Picsart_240825_081626013.jpg)
![playlist_info](https://ucarecdn.com/1f759973-8cc8-49c5-babb-0e60c297ab2e/Screenshot_2024_0825_075240.jpg)
![player](https://ucarecdn.com/2ef47700-0d6c-4114-86c6-6c98544aa116/Picsart_240825_082538385.jpg)

## 📋 Requirements

- ![Node.js](https://img.shields.io/badge/Node.js-026E00?style=for-the-badge) Node.js Version 18.0.0+ [Download](https://nodejs.org/en/download)
Expand Down
1 change: 0 additions & 1 deletion docs/README_VI.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
![playlist_info](https://ucarecdn.com/1f759973-8cc8-49c5-babb-0e60c297ab2e/Screenshot_2024_0825_075240.jpg)
![player](https://ucarecdn.com/2ef47700-0d6c-4114-86c6-6c98544aa116/Picsart_240825_082538385.jpg)


## 📋 Yêu cầu

- ![Node.js](https://img.shields.io/badge/Node.js-026E00?style=for-the-badge) Node.js phiên bản 18.0.0+ [Download](https://nodejs.org/en/download)
Expand Down
54 changes: 27 additions & 27 deletions docs/README_hi.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,28 @@

## 🎶 समर्थित स्रोत

| संगीत स्रोत | लावालिंक प्लगइन के बिना | लावालिंक प्लगइन के साथ |
| :------------------------------: | :---------------------: | :--------------------: |
| यूट्यूब || |
| साउंडक्लाउड || |
| (LS) स्पॉटिफाई | ⚠️ | |
| HTTP || |
| (LS) डीज़र | ⚠️ | |
| ट्विच || |
| बैंडकैम्प || |
| निकोवीडियो | ⚠️ | ⚠️ |
| (LS) एप्पल म्यूजिक | ⚠️ | |
| (LS) यांडेक्स म्यूजिक || |
| (LS) फ्लोवेरी टीटीएस || |
| (DB) मिक्सक्लाउड || |
| (DB) OC रीमिक्स || |
| (DB) क्लीप.इट || |
| (DB) रेडिट || |
| (DB) गेटयार्न || |
| (DB) टेक्स्ट टू स्पीच || |
| (DB) टिक्टोक (बीटा) || |
| (DB) पी\*\*nhub (अनुशंसित नहीं) || |
| (DB) साउंडगैसम || |
| संगीत स्रोत | लावालिंक प्लगइन के बिना | लावालिंक प्लगइन के साथ |
| :-----------------------------: | :---------------------: | :--------------------: |
| यूट्यूब || |
| साउंडक्लाउड || |
| (LS) स्पॉटिफाई | ⚠️ | |
| HTTP || |
| (LS) डीज़र | ⚠️ | |
| ट्विच || |
| बैंडकैम्प || |
| निकोवीडियो | ⚠️ | ⚠️ |
| (LS) एप्पल म्यूजिक | ⚠️ | |
| (LS) यांडेक्स म्यूजिक || |
| (LS) फ्लोवेरी टीटीएस || |
| (DB) मिक्सक्लाउड || |
| (DB) OC रीमिक्स || |
| (DB) क्लीप.इट || |
| (DB) रेडिट || |
| (DB) गेटयार्न || |
| (DB) टेक्स्ट टू स्पीच || |
| (DB) टिक्टोक (बीटा) || |
| (DB) पी\*\*nhub (अनुशंसित नहीं) || |
| (DB) साउंडगैसम || |

-**डिफ़ॉल्ट लावालिंक कॉन्फ़िगरेशन के साथ पूर्ण समर्थन**
- ⚠️ **समर्थित है लेकिन केवल यूट्यूब या साउंडक्लाउड से प्राप्त होता है**
Expand All @@ -77,11 +77,11 @@

## 🔉 समर्थित लावालिंक/नोडलिंक संस्करण

| प्रकार | समर्थित संस्करण | ड्राइवर का नाम |
| -------- | ---------------- | ----------------- |
| लावालिंक | v4.0.0 - v4.x.x | lavalink/v4/koinu |
| लावालिंक | v3.0.0 - v3.7.x | lavalink/v3/koto |
| नोडलिंक | v2.0.0 - v2.x.x | nodelink/v2/nari |
| प्रकार | समर्थित संस्करण | ड्राइवर का नाम |
| -------- | --------------- | ----------------- |
| लावालिंक | v4.0.0 - v4.x.x | lavalink/v4/koinu |
| लावालिंक | v3.0.0 - v3.7.x | lavalink/v3/koto |
| नोडलिंक | v2.0.0 - v2.x.x | nodelink/v2/nari |

## 🖼️ शोकेस

Expand Down
1 change: 0 additions & 1 deletion docs/README_pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
![playlist_info](https://ucarecdn.com/1f759973-8cc8-49c5-babb-0e60c297ab2e/Screenshot_2024_0825_075240.jpg)
![player](https://ucarecdn.com/2ef47700-0d6c-4114-86c6-6c98544aa116/Picsart_240825_082538385.jpg)


## 📋 Requisitos

- ![Node.js](https://img.shields.io/badge/Node.js-026E00?style=for-the-badge) Versão do Node.js 18.0.0+ [Download](https://nodejs.org/en/download)
Expand Down
49 changes: 28 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,51 +48,58 @@
"chalk": "^5.3.0",
"chillout": "^5.0.0",
"common-tags": "^1.8.2",
"discord.js": "^14.14.1",
"discord.js": "^14.16.1",
"dreamvast.quick.db": "10.0.0-unsupported",
"fast-xml-parser": "^4.3.6",
"fastify": "^4.26.2",
"humanize-duration": "^3.31.0",
"fast-xml-parser": "^4.5.0",
"fastify": "^4.28.1",
"humanize-duration": "^3.32.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"markdown-it": "^14.1.0",
"mongoose": "^8.2.3",
"mysql2": "^3.9.2",
"mongoose": "^8.6.1",
"mysql2": "^3.11.0",
"node-cron": "^3.0.3",
"node-html-parser": "^6.1.12",
"nodemon": "^3.1.0",
"node-html-parser": "^6.1.13",
"nodemon": "^3.1.4",
"os": "^0.1.2",
"pg": "^8.11.3",
"pg": "^8.12.0",
"pidusage": "^3.0.2",
"plsargs": "^0.1.6",
"pm2": "^5.3.1",
"pretty-ms": "^9.0.0",
"pm2": "^5.4.2",
"pretty-ms": "^9.1.0",
"rainlink": "^1.0.7",
"rainlink-apple": "^1.0.5",
"rainlink-deezer": "^1.0.8",
"rainlink-nico": "^1.0.7",
"rainlink-spotify": "^1.0.5",
"recursive-readdir": "^2.2.3",
"stuffs": "^0.1.37",
"undici": "^6.10.1",
"stuffs": "^0.1.40",
"undici": "^6.19.8",
"voucher-code-generator": "^1.3.0",
"winston": "^3.12.0",
"winston": "^3.14.2",
"write-file-atomic": "^5.0.1"
},
"devDependencies": {
"@types/chillout": "^5.0.6",
"@types/common-tags": "^1.8.4",
"@types/fs-extra": "^11.0.4",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.0",
"@types/markdown-it": "^13.0.7",
"@types/node": "^20.11.30",
"@types/lodash": "^4.17.7",
"@types/markdown-it": "^13.0.9",
"@types/node": "^20.16.4",
"@types/node-cron": "^3.0.11",
"@types/node-fetch": "^2.6.11",
"@types/pidusage": "^2.0.5",
"@types/recursive-readdir": "^2.2.4",
"@types/voucher-code-generator": "^1.1.3",
"copy-dir": "^1.3.0",
"dir-archiver": "^2.1.0",
"dotenv": "^16.4.5",
"fs-extra": "^11.2.0",
"prettier": "^3.2.5",
"tsx": "^4.7.1",
"typescript": "^5.4.3",
"undici-types": "^6.10.0"
"prettier": "^3.3.3",
"tsx": "^4.19.0",
"typescript": "^5.5.4",
"undici-types": "^6.19.8"
},
"pnpm": {
"overrides": {
Expand Down
4 changes: 2 additions & 2 deletions src/@types/Button.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'discord.js'
import { ButtonInteraction, InteractionCollector, Message } from 'discord.js'
import { Manager } from '../manager.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export class PlayerButton {
name: string = ''
Expand Down
30 changes: 30 additions & 0 deletions src/@types/Cluster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Worker } from 'node:cluster'
import { ClusterManager } from '../cluster/core.js'

export interface ClusterManagerOptions {
shardsPerClusters: number
totalClusters: number
}

export interface WorkerMessage {
cmd: string
args: Record<string, unknown>
}

export interface WorkerResponse {
response: unknown
}

export abstract class ClusterCommand {
public get name(): string {
throw new Error(`This command doesn't have name`)
}

public async execute(
manager: ClusterManager,
worker: Worker,
message: WorkerMessage
): Promise<WorkerResponse> {
throw new Error(`This command doesn't have execute function`)
}
}
2 changes: 1 addition & 1 deletion src/@types/Config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClusterManagerOptions } from '../cluster/core.js'
import { RainlinkNodeOptions } from '../rainlink/main.js'
import { RainlinkNodeOptions } from 'rainlink'

export interface Config {
bot: Bot
Expand Down
2 changes: 1 addition & 1 deletion src/autofix/CheckLavalinkServer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Manager } from '../manager.js'
import { Headers } from '../@types/Lavalink.js'
import { GetLavalinkServer } from './GetLavalinkServer.js'
import { RainlinkWebsocket } from '../rainlink/main.js'
import { RainlinkWebsocket } from 'rainlink'

export class CheckLavalinkServer {
client: Manager
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'clear'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkLoopMode, RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkLoopMode, RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'loop'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
playerRowTwo,
} from '../utilities/PlayerControlButton.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'pause'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Previous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'replay'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { formatDuration } from '../utilities/FormatDuration.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'
import { getTitle } from '../utilities/GetTitle.js'

export default class implements PlayerButton {
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Shuffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { formatDuration } from '../utilities/FormatDuration.js'
import { PageQueue } from '../structures/PageQueue.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'
import { getTitle } from '../utilities/GetTitle.js'

export default class implements PlayerButton {
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'skip'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/Stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'stop'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/VolumeDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'voldown'
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/VolumeUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonInteraction, CacheType, InteractionCollector, Message } from 'dis
import { PlayerButton } from '../@types/Button.js'
import { Manager } from '../manager.js'
import { ReplyInteractionService } from '../services/ReplyInteractionService.js'
import { RainlinkPlayer } from '../rainlink/main.js'
import { RainlinkPlayer } from 'rainlink'

export default class implements PlayerButton {
name = 'volup'
Expand Down
19 changes: 19 additions & 0 deletions src/cluster/commands/getAllWWorkerPID.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ClusterCommand, WorkerMessage, WorkerResponse } from '../../@types/Cluster.js'
import { ClusterManager } from '../core.js'
import { Worker } from 'node:cluster'

export default class extends ClusterCommand {
public get name(): string {
return 'all_worker_pid'
}

public async execute(
manager: ClusterManager,
worker: Worker,
message: WorkerMessage
): Promise<WorkerResponse> {
return {
response: manager.workerPID.full.map((value) => value[1].process.pid),
}
}
}
19 changes: 19 additions & 0 deletions src/cluster/commands/getAllWorkerID.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ClusterCommand, WorkerMessage, WorkerResponse } from '../../@types/Cluster.js'
import { ClusterManager } from '../core.js'
import { Worker } from 'node:cluster'

export default class extends ClusterCommand {
public get name(): string {
return 'all_worker_id'
}

public async execute(
manager: ClusterManager,
worker: Worker,
message: WorkerMessage
): Promise<WorkerResponse> {
return {
response: manager.workerPID.full.map((value) => value[0]),
}
}
}
Loading

0 comments on commit 73a85a6

Please sign in to comment.