for-modules 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE.txt +12 -0
- package/README.md +1 -0
- package/babel.config.json +6 -0
- package/dist/Structures/Filters.d.ts +109 -0
- package/dist/Structures/Filters.js +296 -0
- package/dist/Structures/Manager.d.ts +192 -0
- package/dist/Structures/Manager.js +580 -0
- package/dist/Structures/Node.d.ts +140 -0
- package/dist/Structures/Node.js +588 -0
- package/dist/Structures/Player.d.ts +250 -0
- package/dist/Structures/Player.js +750 -0
- package/dist/Structures/Queue.d.ts +38 -0
- package/dist/Structures/Queue.js +180 -0
- package/dist/Structures/Rest.d.ts +60 -0
- package/dist/Structures/Rest.js +246 -0
- package/dist/Structures/Utils.d.ts +174 -0
- package/dist/Structures/Utils.js +318 -0
- package/dist/Utils/FiltersEqualizers.d.ts +12 -0
- package/dist/Utils/FiltersEqualizers.js +227 -0
- package/dist/Utils/ManagerCheck.d.ts +2 -0
- package/dist/Utils/ManagerCheck.js +75 -0
- package/dist/Utils/NodeCheck.d.ts +2 -0
- package/dist/Utils/NodeCheck.js +54 -0
- package/dist/Utils/PlayerCheck.d.ts +2 -0
- package/dist/Utils/PlayerCheck.js +38 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +127 -0
- package/eslint.config.d.ts +2 -0
- package/eslint.config.js +12 -0
- package/package.json +51 -0
- package/renovate.json +6 -0
- package/tsconfig.json +25 -0
@@ -0,0 +1,140 @@
|
|
1
|
+
import { PlayerEvent, PlayerEvents, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, WebSocketClosedEvent } from "./Utils";
|
2
|
+
import { Manager } from "./Manager";
|
3
|
+
import { Player, Track, UnresolvedTrack } from "./Player";
|
4
|
+
import { Rest } from "./Rest";
|
5
|
+
import WebSocket from "ws";
|
6
|
+
export declare class Node {
|
7
|
+
options: NodeOptions;
|
8
|
+
/** The socket for the node. */
|
9
|
+
socket: WebSocket | null;
|
10
|
+
/** The stats for the node. */
|
11
|
+
stats: NodeStats;
|
12
|
+
manager: Manager;
|
13
|
+
/** The node's session ID. */
|
14
|
+
sessionId: string | null;
|
15
|
+
/** The REST instance. */
|
16
|
+
readonly rest: Rest;
|
17
|
+
private static _manager;
|
18
|
+
private reconnectTimeout?;
|
19
|
+
private reconnectAttempts;
|
20
|
+
/** Returns if connected to the Node. */
|
21
|
+
get connected(): boolean;
|
22
|
+
/** Returns the address for this node. */
|
23
|
+
get address(): string;
|
24
|
+
/** @hidden */
|
25
|
+
static init(manager: Manager): void;
|
26
|
+
/**
|
27
|
+
* Creates an instance of Node.
|
28
|
+
* @param options
|
29
|
+
*/
|
30
|
+
constructor(options: NodeOptions);
|
31
|
+
/** Connects to the Node. */
|
32
|
+
connect(): void;
|
33
|
+
/** Destroys the Node and all players connected with it. */
|
34
|
+
destroy(): void;
|
35
|
+
private reconnect;
|
36
|
+
protected open(): void;
|
37
|
+
protected close(code: number, reason: string): void;
|
38
|
+
protected error(error: Error): void;
|
39
|
+
protected message(d: Buffer | string): void;
|
40
|
+
protected handleEvent(payload: PlayerEvent & PlayerEvents): Promise<void>;
|
41
|
+
protected trackStart(player: Player, track: Track, payload: TrackStartEvent): void;
|
42
|
+
protected trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
|
43
|
+
extractSpotifyTrackID(url: string): string | null;
|
44
|
+
extractSpotifyArtistID(url: string): string | null;
|
45
|
+
private handleAutoplay;
|
46
|
+
private handleFailedTrack;
|
47
|
+
private handleRepeatedTrack;
|
48
|
+
private playNextTrack;
|
49
|
+
protected queueEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
|
50
|
+
protected trackStuck(player: Player, track: Track, payload: TrackStuckEvent): void;
|
51
|
+
protected trackError(player: Player, track: Track | UnresolvedTrack, payload: TrackExceptionEvent): void;
|
52
|
+
protected socketClosed(player: Player, payload: WebSocketClosedEvent): void;
|
53
|
+
}
|
54
|
+
export interface NodeOptions {
|
55
|
+
/** The host for the node. */
|
56
|
+
host: string;
|
57
|
+
/** The port for the node. */
|
58
|
+
port?: number;
|
59
|
+
/** The password for the node. */
|
60
|
+
password?: string;
|
61
|
+
/** Whether the host uses SSL. */
|
62
|
+
secure?: boolean;
|
63
|
+
/** The identifier for the node. */
|
64
|
+
identifier?: string;
|
65
|
+
/** The retryAmount for the node. */
|
66
|
+
retryAmount?: number;
|
67
|
+
/** The retryDelay for the node. */
|
68
|
+
retryDelay?: number;
|
69
|
+
/** Whether to resume the previous session. */
|
70
|
+
resumeStatus?: boolean;
|
71
|
+
/** The time the manager will wait before trying to resume the previous session. */
|
72
|
+
resumeTimeout?: number;
|
73
|
+
/** The timeout used for api calls. */
|
74
|
+
requestTimeout?: number;
|
75
|
+
/** Priority of the node. */
|
76
|
+
priority?: number;
|
77
|
+
}
|
78
|
+
export interface NodeStats {
|
79
|
+
/** The amount of players on the node. */
|
80
|
+
players: number;
|
81
|
+
/** The amount of playing players on the node. */
|
82
|
+
playingPlayers: number;
|
83
|
+
/** The uptime for the node. */
|
84
|
+
uptime: number;
|
85
|
+
/** The memory stats for the node. */
|
86
|
+
memory: MemoryStats;
|
87
|
+
/** The cpu stats for the node. */
|
88
|
+
cpu: CPUStats;
|
89
|
+
/** The frame stats for the node. */
|
90
|
+
frameStats: FrameStats;
|
91
|
+
}
|
92
|
+
export interface MemoryStats {
|
93
|
+
/** The free memory of the allocated amount. */
|
94
|
+
free: number;
|
95
|
+
/** The used memory of the allocated amount. */
|
96
|
+
used: number;
|
97
|
+
/** The total allocated memory. */
|
98
|
+
allocated: number;
|
99
|
+
/** The reservable memory. */
|
100
|
+
reservable: number;
|
101
|
+
}
|
102
|
+
export interface CPUStats {
|
103
|
+
/** The core amount the host machine has. */
|
104
|
+
cores: number;
|
105
|
+
/** The system load. */
|
106
|
+
systemLoad: number;
|
107
|
+
/** The lavalink load. */
|
108
|
+
lavalinkLoad: number;
|
109
|
+
}
|
110
|
+
export interface FrameStats {
|
111
|
+
/** The amount of sent frames. */
|
112
|
+
sent?: number;
|
113
|
+
/** The amount of nulled frames. */
|
114
|
+
nulled?: number;
|
115
|
+
/** The amount of deficit frames. */
|
116
|
+
deficit?: number;
|
117
|
+
}
|
118
|
+
export interface LavalinkInfo {
|
119
|
+
version: {
|
120
|
+
semver: string;
|
121
|
+
major: number;
|
122
|
+
minor: number;
|
123
|
+
patch: number;
|
124
|
+
preRelease: string;
|
125
|
+
};
|
126
|
+
buildTime: number;
|
127
|
+
git: {
|
128
|
+
branch: string;
|
129
|
+
commit: string;
|
130
|
+
commitTime: number;
|
131
|
+
};
|
132
|
+
jvm: string;
|
133
|
+
lavaplayer: string;
|
134
|
+
sourceManagers: string[];
|
135
|
+
filters: string[];
|
136
|
+
plugins: {
|
137
|
+
name: string;
|
138
|
+
version: string;
|
139
|
+
}[];
|
140
|
+
}
|