Skip to content

Commit

Permalink
v2.4.5 + re-stylings for everything and modifications on testBot
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomato6966 committed Jan 13, 2025
1 parent 9fb2fc7 commit 78216ee
Show file tree
Hide file tree
Showing 58 changed files with 951 additions and 812 deletions.
188 changes: 94 additions & 94 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,103 +5,103 @@ import starlightTypeDoc, { typeDocSidebarGroup } from "starlight-typedoc"

// https://astro.build/config
export default defineConfig({
site: "https://tomato6966.github.io/",
base: "lavalink-client",
integrations: [
starlight({
title: "Lavalink Client",
social: {
github: "https://github.com/Tomato6966/lavalink-client",
site: "https://tomato6966.github.io/",
base: "lavalink-client",
integrations: [
starlight({
title: "Lavalink Client",
social: {
github: "https://github.com/Tomato6966/lavalink-client",
discord: "https://discord.gg/AsgD3gtPnb",
email: "mailto:[email protected]",
},
editLink: {
baseUrl: "https://github.com/Tomato6966/lavalink-client/tree/main",
},
plugins: [
// Generate the documentation.
starlightTypeDoc({
entryPoints: ["../src/structures/**/*.ts"],
tsconfig: "../tsconfig.json",
typeDoc: {
useCodeBlocks: true,
parametersFormat: "table",
propertiesFormat: "table",
enumMembersFormat: "table",
typeDeclarationFormat: "table",
indexFormat: "table",
expandParameters: true,
name: "Lavalink Client",
},
pagination: true,
}),
],
sidebar: [
{
label: "Getting Started",
collapsed: true,
items: [
{
label: "installation",
link: "/home/installation",
},
{
label: "Setup Lavalink-Server",
link: "/home/setup-lavalink",
},
{
label: "Features",
link: "/home/features",
},
{
label: "Example Guides",
link: "/home/example",
},
{
label: "Sample Configuration",
link: "/home/configuration",
},
},
editLink: {
baseUrl: "https://github.com/Tomato6966/lavalink-client/tree/main",
},
plugins: [
// Generate the documentation.
starlightTypeDoc({
entryPoints: ["../src/structures/**/*.ts"],
tsconfig: "../tsconfig.json",
typeDoc: {
useCodeBlocks: true,
parametersFormat: "table",
propertiesFormat: "table",
enumMembersFormat: "table",
typeDeclarationFormat: "table",
indexFormat: "table",
expandParameters: true,
name: "Lavalink Client",
},
pagination: true,
}),
],
sidebar: [
{
label: "Getting Started",
collapsed: true,
items: [
{
label: "installation",
link: "/home/installation",
},
{
label: "Setup Lavalink-Server",
link: "/home/setup-lavalink",
},
{
label: "Features",
link: "/home/features",
},
{
label: "Example Guides",
link: "/home/example",
},
{
label: "Sample Configuration",
link: "/home/configuration",
},
{
label: "Checkout Docs (Manager-Class)",
link: "/api/lavalinkmanager/classes/lavalinkmanager"
},
],
},
{
label: "Extra",
collapsed: true,
items: [
{
label: "Manager Events",
link: "/extra/manager-events",
},
{
label: "Node Events",
link: "/extra/node-events",
},
{
label: "Resuming",
link: "/extra/resuming",
},
{
label: "Version-Update-Log",
link: "/extra/version-log",
}
]
},
typeDocSidebarGroup,
{
label: "GitHub",
link: "https://github.com/Tomato6966/lavalink-client",
},
{
label: "NPM",
link: "https://npmjs.com/lavalink-client",
},
{
label: "Example Bot",
link: "https://github.com/Tomato6966/lavalink-client/tree/main/testBot",
},
],
},
{
label: "Extra",
collapsed: true,
items: [
{
label: "Manager Events",
link: "/extra/manager-events",
},
{
label: "Node Events",
link: "/extra/node-events",
},
{
label: "Resuming",
link: "/extra/resuming",
},
{
label: "Version-Update-Log",
link: "/extra/version-log",
}
]
},
typeDocSidebarGroup,
{
label: "GitHub",
link: "https://github.com/Tomato6966/lavalink-client",
},
{
label: "NPM",
link: "https://npmjs.com/lavalink-client",
},
{
label: "Example Bot",
link: "https://github.com/Tomato6966/lavalink-client/tree/main/testBot",
},
{
label: "Official Lavalink-Discord",
link: "https://discord.gg/lavalink-1082302532421943407"
Expand All @@ -110,7 +110,7 @@ export default defineConfig({
label: "Official Lavalink-Web",
link: "https://lavalink.dev"
}
],
}),
],
],
}),
],
});
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lavalink-client",
"version": "2.4.4",
"version": "2.4.5",
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -58,22 +58,22 @@
},
"homepage": "https://tomato6966.github.io/lavalink-client/",
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.0",
"@types/node": "^22.5.5",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"eslint": "^9.11.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@types/node": "^22.10.5",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"eslint": "^9.18.0",
"tsc-alias": "^1.8.10",
"typescript": "^5.6.2"
"typescript": "^5.7.3"
},
"dependencies": {
"tslib": "^2.7.0",
"tslib": "^2.8.1",
"ws": "^8.18.0"
},
"engines": {
"node": ">=18.0.0",
"bun": ">=1.0.0"
"bun": ">=1.1.27"
}
}
1 change: 0 additions & 1 deletion src/structures/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export enum DestroyReasons {
ChannelDeleted = "ChannelDeleted",
DisconnectAllNodes = "DisconnectAllNodes",
ReconnectAllNodes = "ReconnectAllNodes",

TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
};
Expand Down
18 changes: 9 additions & 9 deletions src/structures/LavalinkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export class LavalinkManager extends EventEmitter {
if ("token" in update) {
if (!player.node?.sessionId) throw new Error("Lavalink Node is either not ready or not up to date");
const sessionId2Use = player.voice?.sessionId || ("sessionId" in update ? update.sessionId as string : undefined);
if(!sessionId2Use) {
if (!sessionId2Use) {
this.emit("debug", DebugEvents.NoAudioDebug, {
state: "error",
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${JSON.stringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, update, playerVoice: player.voice }, null, 2)}`,
Expand Down Expand Up @@ -540,7 +540,7 @@ export class LavalinkManager extends EventEmitter {

/* voice state update */
if (update.user_id !== this.options?.client.id) {
if(update.user_id && player.voiceChannelId) {
if (update.user_id && player.voiceChannelId) {
this.emit(update.channel_id === player.voiceChannelId ? "playerVoiceJoin" : "playerVoiceLeave", player, update.user_id);
}

Expand All @@ -561,7 +561,7 @@ export class LavalinkManager extends EventEmitter {

player.voice.sessionId = update.session_id || player.voice.sessionId;

if(!player.voice.sessionId) {
if (!player.voice.sessionId) {
if (this.options?.advancedOptions?.enableDebugEvents) {
this.emit("debug", DebugEvents.NoAudioDebug, {
state: "warn",
Expand All @@ -586,9 +586,9 @@ export class LavalinkManager extends EventEmitter {
player.voiceState.serverMute = update.mute ?? player.voiceState?.serverMute;
player.voiceState.suppress = update.suppress ?? player.voiceState?.suppress;

if(selfMuteChanged || serverMuteChanged) this.emit("playerMuteChange", player, player.voiceState.selfMute, player.voiceState.serverMute);
if(selfDeafChanged || serverDeafChanged) this.emit("playerDeafChange", player, player.voiceState.selfDeaf, player.voiceState.serverDeaf);
if(suppressChange) this.emit("playerSuppressChange", player, player.voiceState.suppress);
if (selfMuteChanged || serverMuteChanged) this.emit("playerMuteChange", player, player.voiceState.selfMute, player.voiceState.serverMute);
if (selfDeafChanged || serverDeafChanged) this.emit("playerDeafChange", player, player.voiceState.selfDeaf, player.voiceState.serverDeaf);
if (suppressChange) this.emit("playerSuppressChange", player, player.voiceState.suppress);

} else {

Expand Down Expand Up @@ -616,15 +616,15 @@ export class LavalinkManager extends EventEmitter {
}

// connect if there are tracks & autoReconnectOnlyWithTracks = true or autoReconnectOnlyWithTracks is false
if(!autoReconnectOnlyWithTracks || (autoReconnectOnlyWithTracks && (player.queue.current || player.queue.tracks.length))) {
if (!autoReconnectOnlyWithTracks || (autoReconnectOnlyWithTracks && (player.queue.current || player.queue.tracks.length))) {
await player.connect();
}
// replay the current playing stream
if(player.queue.current) {
if (player.queue.current) {
return void await player.play({ position: previousPosition, paused: previousPaused, clientTrack: player.queue.current, });
}
// try to play the next track
if(player.queue.tracks.length) {
if (player.queue.tracks.length) {
return void await player.play({ paused: previousPaused });
}
// debug log if nothing was possible
Expand Down
Loading

0 comments on commit 78216ee

Please sign in to comment.