Skip to content

Commit

Permalink
Update package.json version to 4.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed Apr 13, 2024
1 parent 472ca38 commit f9c234e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lavamusic",
"version": "4.0.8",
"version": "4.0.9",
"description": "LavaMusic is a music bot for Discord, written in JavaScript using the Discord.js, Typescript, Shoukaku (Lavalink) library.",
"main": "dist/index.js",
"type": "module",
Expand Down
13 changes: 13 additions & 0 deletions src/events/player/NodeDestroy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Event, Lavamusic } from '../../structures/index.js';
import BotLog from '../../utils/BotLog.js';

let destroyCount = 0;

export default class NodeDestroy extends Event {
constructor(client: Lavamusic, file: string) {
super(client, file, {
Expand All @@ -14,5 +16,16 @@ export default class NodeDestroy extends Event {
`Node ${node} destroyed with code ${code} and reason ${reason}`,
'error'
);
destroyCount++;
if (destroyCount >= 5) {
this.client.shoukaku.removeNode(node);
destroyCount = 0;
this.client.logger.warn(`Node ${node} removed from nodes list due to excessive disconnects`);
BotLog.send(
this.client,
`Node ${node} removed from nodes list due to excessive disconnects`,
'warn'
);
}
}
}

0 comments on commit f9c234e

Please sign in to comment.