for-modules 1.1.4 → 1.1.6

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.
@@ -1,250 +0,0 @@
1
- import { Filters } from "./Filters";
2
- import { Manager, SearchQuery, SearchResult } from "./Manager";
3
- import { Node } from "./Node";
4
- import { Queue } from "./Queue";
5
- import { Sizes, State, TrackSourceName, VoiceState } from "./Utils";
6
- import { ClientUser, Message, User } from "discord.js";
7
- export declare class Player {
8
- options: PlayerOptions;
9
- /** The Queue for the Player. */
10
- readonly queue: Queue;
11
- /** The filters applied to the audio. */
12
- filters: Filters;
13
- /** Whether the queue repeats the track. */
14
- trackRepeat: boolean;
15
- /** Whether the queue repeats the queue. */
16
- queueRepeat: boolean;
17
- /**Whether the queue repeats and shuffles after each song. */
18
- dynamicRepeat: boolean;
19
- /** The time the player is in the track. */
20
- position: number;
21
- /** Whether the player is playing. */
22
- playing: boolean;
23
- /** Whether the player is paused. */
24
- paused: boolean;
25
- /** The volume for the player */
26
- volume: number;
27
- /** The Node for the Player. */
28
- node: Node;
29
- /** The guild for the player. */
30
- guild: string;
31
- /** The voice channel for the player. */
32
- voiceChannel: string | null;
33
- /** The text channel for the player. */
34
- textChannel: string | null;
35
- /**The now playing message. */
36
- nowPlayingMessage?: Message;
37
- /** The current state of the player. */
38
- state: State;
39
- /** The equalizer bands array. */
40
- bands: number[];
41
- /** The voice state object from Discord. */
42
- voiceState: VoiceState;
43
- /** The Manager. */
44
- manager: Manager;
45
- /** The autoplay state of the player. */
46
- isAutoplay: boolean;
47
- private static _manager;
48
- private readonly data;
49
- private dynamicLoopInterval;
50
- /**
51
- * Set custom data.
52
- * @param key
53
- * @param value
54
- */
55
- set(key: string, value: unknown): void;
56
- /**
57
- * Get custom data.
58
- * @param key
59
- */
60
- get<T>(key: string): T;
61
- /** @hidden */
62
- static init(manager: Manager): void;
63
- /**
64
- * Creates a new player, returns one if it already exists.
65
- * @param options
66
- */
67
- constructor(options: PlayerOptions);
68
- /**
69
- * Same as Manager#search() but a shortcut on the player itself.
70
- * @param query
71
- * @param requester
72
- */
73
- search(query: string | SearchQuery, requester?: User | ClientUser): Promise<SearchResult>;
74
- /** Connect to the voice channel. */
75
- connect(): this;
76
- /**
77
- * Moves the player to a different node.
78
- *
79
- * @param {string} [node] - The ID of the node to move to.
80
- * @returns {this} - The player instance.
81
- */
82
- moveNode(node?: string): Promise<this>;
83
- /** Disconnect from the voice channel. */
84
- disconnect(): this;
85
- /** Destroys the player. */
86
- destroy(disconnect?: boolean): void;
87
- /**
88
- * Sets the player voice channel.
89
- * @param channel
90
- */
91
- setVoiceChannel(channel: string): this;
92
- /**
93
- * Sets the player text channel.
94
- * @param channel
95
- */
96
- setTextChannel(channel: string): this;
97
- /** Sets the now playing message. */
98
- setNowPlayingMessage(message: Message): Message;
99
- /** Plays the next track. */
100
- play(): Promise<void>;
101
- /**
102
- * Plays the specified track.
103
- * @param track
104
- */
105
- play(track: Track | UnresolvedTrack): Promise<void>;
106
- /**
107
- * Plays the next track with some options.
108
- * @param options
109
- */
110
- play(options: PlayOptions): Promise<void>;
111
- /**
112
- * Plays the specified track with some options.
113
- * @param track
114
- * @param options
115
- */
116
- play(track: Track | UnresolvedTrack, options: PlayOptions): Promise<void>;
117
- /**
118
- * Sets the autoplay-state of the player.
119
- * @param autoplayState
120
- * @param botUser
121
- */
122
- setAutoplay(autoplayState: boolean, botUser: object): this;
123
- /**
124
- * Gets recommended tracks and returns an array of tracks.
125
- * @param track
126
- * @param requester
127
- */
128
- getRecommended(track: Track, requester?: User | ClientUser): Promise<Track[]>;
129
- /**
130
- * Sets the player volume.
131
- * @param volume
132
- */
133
- setVolume(volume: number): this;
134
- /**
135
- * Sets the track repeat.
136
- * @param repeat
137
- */
138
- setTrackRepeat(repeat: boolean): this;
139
- /**
140
- * Sets the queue repeat.
141
- * @param repeat
142
- */
143
- setQueueRepeat(repeat: boolean): this;
144
- /**
145
- * Sets the queue to repeat and shuffles the queue after each song.
146
- * @param repeat "true" or "false".
147
- * @param ms After how many milliseconds to trigger dynamic repeat.
148
- */
149
- setDynamicRepeat(repeat: boolean, ms: number): this;
150
- /** Restarts the current track to the start. */
151
- restart(): void;
152
- /** Stops the current track, optionally give an amount to skip to, e.g 5 would play the 5th song. */
153
- stop(amount?: number): this;
154
- /**
155
- * Pauses the current track.
156
- * @param pause
157
- */
158
- pause(pause: boolean): this;
159
- /** Go back to the previous song. */
160
- previous(): this;
161
- /**
162
- * Seeks to the position in the current track.
163
- * @param position
164
- */
165
- seek(position: number): this;
166
- }
167
- export interface PlayerOptions {
168
- /** The guild the Player belongs to. */
169
- guild: string;
170
- /** The text channel the Player belongs to. */
171
- textChannel: string;
172
- /** The voice channel the Player belongs to. */
173
- voiceChannel?: string;
174
- /** The node the Player uses. */
175
- node?: string;
176
- /** The initial volume the Player will use. */
177
- volume?: number;
178
- /** If the player should mute itself. */
179
- selfMute?: boolean;
180
- /** If the player should deaf itself. */
181
- selfDeafen?: boolean;
182
- }
183
- /** If track partials are set some of these will be `undefined` as they were removed. */
184
- export interface Track {
185
- /** The base64 encoded track. */
186
- readonly track: string;
187
- /** The artwork url of the track. */
188
- readonly artworkUrl: string;
189
- /** The track source name. */
190
- readonly sourceName: TrackSourceName;
191
- /** The title of the track. */
192
- title: string;
193
- /** The identifier of the track. */
194
- readonly identifier: string;
195
- /** The author of the track. */
196
- author: string;
197
- /** The duration of the track. */
198
- readonly duration: number;
199
- /** The ISRC of the track. */
200
- readonly isrc: string;
201
- /** If the track is seekable. */
202
- readonly isSeekable: boolean;
203
- /** If the track is a stream.. */
204
- readonly isStream: boolean;
205
- /** The uri of the track. */
206
- readonly uri: string;
207
- /** The thumbnail of the track or null if it's a unsupported source. */
208
- readonly thumbnail: string | null;
209
- /** The user that requested the track. */
210
- readonly requester: User | ClientUser | null;
211
- /** Displays the track thumbnail with optional size or null if it's a unsupported source. */
212
- displayThumbnail(size?: Sizes): string;
213
- /** Additional track info provided by plugins. */
214
- pluginInfo: TrackPluginInfo;
215
- /** Add your own data to the track. */
216
- customData: Record<string, unknown>;
217
- }
218
- export interface TrackPluginInfo {
219
- albumName?: string;
220
- albumUrl?: string;
221
- artistArtworkUrl?: string;
222
- artistUrl?: string;
223
- isPreview?: string;
224
- previewUrl?: string;
225
- }
226
- /** Unresolved tracks can't be played normally, they will resolve before playing into a Track. */
227
- export interface UnresolvedTrack extends Partial<Track> {
228
- /** The title to search against. */
229
- title: string;
230
- /** The author to search against. */
231
- author?: string;
232
- /** The duration to search within 1500 milliseconds of the results from YouTube. */
233
- duration?: number;
234
- /** Resolves into a Track. */
235
- resolve(): Promise<void>;
236
- }
237
- export interface PlayOptions {
238
- /** The position to start the track. */
239
- readonly startTime?: number;
240
- /** The position to end the track. */
241
- readonly endTime?: number;
242
- /** Whether to not replace the track if a play payload is sent. */
243
- readonly noReplace?: boolean;
244
- }
245
- export interface EqualizerBand {
246
- /** The band number being 0 to 14. */
247
- band: number;
248
- /** The gain amount being -0.25 to 1.00, 0.25 being double. */
249
- gain: number;
250
- }
@@ -1,38 +0,0 @@
1
- import { Track, UnresolvedTrack } from "./Player";
2
- /**
3
- * The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
4
- */
5
- export declare class Queue extends Array<Track | UnresolvedTrack> {
6
- /** The total duration of the queue. */
7
- get duration(): number;
8
- /** The total size of tracks in the queue including the current track. */
9
- get totalSize(): number;
10
- /** The size of tracks in the queue. */
11
- get size(): number;
12
- /** The current track */
13
- current: Track | UnresolvedTrack | null;
14
- /** The previous track */
15
- previous: Track | UnresolvedTrack | null;
16
- /**
17
- * Adds a track to the queue.
18
- * @param track
19
- * @param [offset=null]
20
- */
21
- add(track: (Track | UnresolvedTrack) | (Track | UnresolvedTrack)[], offset?: number): void;
22
- /**
23
- * Removes a track from the queue. Defaults to the first track, returning the removed track, EXCLUDING THE `current` TRACK.
24
- * @param [position=0]
25
- */
26
- remove(position?: number): (Track | UnresolvedTrack)[];
27
- /**
28
- * Removes an amount of tracks using a exclusive start and end exclusive index, returning the removed tracks, EXCLUDING THE `current` TRACK.
29
- * @param start
30
- * @param end
31
- */
32
- remove(start: number, end: number): (Track | UnresolvedTrack)[];
33
- /** Clears the queue. */
34
- clear(): void;
35
- /** Shuffles the queue. */
36
- shuffle(): void;
37
- equalizedShuffle(): void;
38
- }
@@ -1,60 +0,0 @@
1
- import { Node } from "./Node";
2
- /** Handles the requests sent to the Lavalink REST API. */
3
- export declare class Rest {
4
- /** The Node that this Rest instance is connected to. */
5
- private node;
6
- /** The ID of the current session. */
7
- private sessionId;
8
- /** The password for the Node. */
9
- private readonly password;
10
- /** The URL of the Node. */
11
- private readonly url;
12
- constructor(node: Node);
13
- /**
14
- * Sets the session ID.
15
- * @returns {string} Returns the session ID.
16
- */
17
- setSessionId(sessionId: string): string;
18
- /** Retrieves all the players that are currently running on the node. */
19
- getAllPlayers(): Promise<unknown>;
20
- /** Sends a PATCH request to update player related data. */
21
- updatePlayer(options: playOptions): Promise<unknown>;
22
- /** Sends a DELETE request to the server to destroy the player. */
23
- destroyPlayer(guildId: string): Promise<unknown>;
24
- private request;
25
- get(endpoint: string): Promise<unknown>;
26
- patch(endpoint: string, body: unknown): Promise<unknown>;
27
- post(endpoint: string, body: unknown): Promise<unknown>;
28
- delete(endpoint: string): Promise<unknown>;
29
- }
30
- interface playOptions {
31
- guildId: string;
32
- data: {
33
- /** The base64 encoded track. */
34
- encodedTrack?: string;
35
- /** The track ID. */
36
- identifier?: string;
37
- /** The track time to start at. */
38
- startTime?: number;
39
- /** The track time to end at. */
40
- endTime?: number;
41
- /** The player volume level. */
42
- volume?: number;
43
- /** The player position in a track. */
44
- position?: number;
45
- /** Whether the player is paused. */
46
- paused?: boolean;
47
- /** The audio effects. */
48
- filters?: object;
49
- /** voice payload. */
50
- voice?: {
51
- token: string;
52
- sessionId: string;
53
- endpoint: string;
54
- };
55
- /** Whether to not replace the track if a play payload is sent. */
56
- noReplace?: boolean;
57
- };
58
- }
59
- export type Method = "GET" | "POST" | "PATCH" | "DELETE";
60
- export {};
@@ -1,174 +0,0 @@
1
- import { ClientUser, User } from "discord.js";
2
- import { Manager } from "./Manager";
3
- import { Node, NodeStats } from "./Node";
4
- import { Player, Track, UnresolvedTrack } from "./Player";
5
- import { Queue } from "./Queue";
6
- export declare abstract class TrackUtils {
7
- static trackPartial: string[] | null;
8
- private static manager;
9
- /** @hidden */
10
- static init(manager: Manager): void;
11
- static setTrackPartial(partial: string[]): void;
12
- /**
13
- * Checks if the provided argument is a valid Track or UnresolvedTrack, if provided an array then every element will be checked.
14
- * @param trackOrTracks
15
- */
16
- static validate(trackOrTracks: unknown): boolean;
17
- /**
18
- * Checks if the provided argument is a valid UnresolvedTrack.
19
- * @param track
20
- */
21
- static isUnresolvedTrack(track: unknown): boolean;
22
- /**
23
- * Checks if the provided argument is a valid Track.
24
- * @param track
25
- */
26
- static isTrack(track: unknown): boolean;
27
- /**
28
- * Builds a Track from the raw data from Lavalink and a optional requester.
29
- * @param data
30
- * @param requester
31
- */
32
- static build(data: TrackData, requester?: User | ClientUser): Track;
33
- /**
34
- * Builds a UnresolvedTrack to be resolved before being played .
35
- * @param query
36
- * @param requester
37
- */
38
- static buildUnresolved(query: string | UnresolvedQuery, requester?: User | ClientUser): UnresolvedTrack;
39
- static getClosestTrack(unresolvedTrack: UnresolvedTrack): Promise<Track>;
40
- }
41
- /** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
42
- export declare abstract class Structure {
43
- /**
44
- * Extends a class.
45
- * @param name
46
- * @param extender
47
- */
48
- static extend<K extends keyof Extendable, T extends Extendable[K]>(name: K, extender: (target: Extendable[K]) => T): T;
49
- /**
50
- * Get a structure from available structures by name.
51
- * @param name
52
- */
53
- static get<K extends keyof Extendable>(name: K): Extendable[K];
54
- }
55
- export declare class Plugin {
56
- load(manager: Manager): void;
57
- unload(manager: Manager): void;
58
- }
59
- export interface UnresolvedQuery {
60
- /** The title of the unresolved track. */
61
- title: string;
62
- /** The author of the unresolved track. If provided it will have a more precise search. */
63
- author?: string;
64
- /** The duration of the unresolved track. If provided it will have a more precise search. */
65
- duration?: number;
66
- }
67
- export type Sizes = "0" | "1" | "2" | "3" | "default" | "mqdefault" | "hqdefault" | "maxresdefault";
68
- export type LoadType = "track" | "playlist" | "search" | "empty" | "error";
69
- export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING" | "MOVING";
70
- export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent;
71
- export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent";
72
- export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
73
- export type Severity = "common" | "suspicious" | "fault";
74
- export interface TrackData {
75
- /** The track information. */
76
- encoded: string;
77
- /** The detailed information of the track. */
78
- info: TrackDataInfo;
79
- /** Additional track info provided by plugins. */
80
- pluginInfo: Record<string, string>;
81
- }
82
- export interface TrackDataInfo {
83
- identifier: string;
84
- isSeekable: boolean;
85
- author: string;
86
- length: number;
87
- isrc?: string;
88
- isStream: boolean;
89
- title: string;
90
- uri?: string;
91
- artworkUrl?: string;
92
- sourceName?: TrackSourceName;
93
- }
94
- export type TrackSourceName = "deezer" | "spotify" | "soundcloud" | "youtube";
95
- export interface Extendable {
96
- Player: typeof Player;
97
- Queue: typeof Queue;
98
- Node: typeof Node;
99
- }
100
- export interface VoiceState {
101
- op: "voiceUpdate";
102
- guildId: string;
103
- event: VoiceServer;
104
- sessionId?: string;
105
- }
106
- export interface VoiceServer {
107
- token: string;
108
- guild_id: string;
109
- endpoint: string;
110
- }
111
- export interface VoiceState {
112
- guild_id: string;
113
- user_id: string;
114
- session_id: string;
115
- channel_id: string;
116
- }
117
- export interface VoicePacket {
118
- t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
119
- d: VoiceState | VoiceServer;
120
- }
121
- export interface NodeMessage extends NodeStats {
122
- type: PlayerEventType;
123
- op: "stats" | "playerUpdate" | "event";
124
- guildId: string;
125
- }
126
- export interface PlayerEvent {
127
- op: "event";
128
- type: PlayerEventType;
129
- guildId: string;
130
- }
131
- export interface Exception {
132
- message: string;
133
- severity: Severity;
134
- cause: string;
135
- }
136
- export interface TrackStartEvent extends PlayerEvent {
137
- type: "TrackStartEvent";
138
- track: TrackData;
139
- }
140
- export interface TrackEndEvent extends PlayerEvent {
141
- type: "TrackEndEvent";
142
- track: TrackData;
143
- reason: TrackEndReason;
144
- }
145
- export interface TrackExceptionEvent extends PlayerEvent {
146
- exception?: Exception;
147
- guildId: string;
148
- type: "TrackExceptionEvent";
149
- }
150
- export interface TrackStuckEvent extends PlayerEvent {
151
- type: "TrackStuckEvent";
152
- thresholdMs: number;
153
- }
154
- export interface WebSocketClosedEvent extends PlayerEvent {
155
- type: "WebSocketClosedEvent";
156
- code: number;
157
- reason: string;
158
- byRemote: boolean;
159
- }
160
- export interface PlayerUpdate {
161
- op: "playerUpdate";
162
- /** The guild id of the player. */
163
- guildId: string;
164
- state: {
165
- /** Unix timestamp in milliseconds. */
166
- time: number;
167
- /** The position of the track in milliseconds. */
168
- position: number;
169
- /** Whether Lavalink is connected to the voice gateway. */
170
- connected: boolean;
171
- /** The ping of the node to the Discord voice server in milliseconds (-1 if not connected). */
172
- ping: number;
173
- };
174
- }
@@ -1,12 +0,0 @@
1
- /** Represents an equalizer band. */
2
- export interface Band {
3
- /** The index of the equalizer band. */
4
- band: number;
5
- /** The gain value of the equalizer band. */
6
- gain: number;
7
- }
8
- export declare const bassBoostEqualizer: Band[];
9
- export declare const softEqualizer: Band[];
10
- export declare const tvEqualizer: Band[];
11
- export declare const trebleBassEqualizer: Band[];
12
- export declare const vaporwaveEqualizer: Band[];
@@ -1,2 +0,0 @@
1
- import { ManagerOptions } from "../Structures/Manager";
2
- export default function ManagerCheck(options: ManagerOptions): void;
@@ -1,2 +0,0 @@
1
- import { NodeOptions } from "../Structures/Node";
2
- export default function NodeCheck(options: NodeOptions): void;
@@ -1,2 +0,0 @@
1
- import { PlayerOptions } from "../Structures/Player";
2
- export default function PlayerCheck(options: PlayerOptions): void;
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export * from "./Structures/Manager";
2
- export * from "./Structures/Node";
3
- export * from "./Structures/Player";
4
- export * from "./Structures/Queue";
5
- export * from "./Structures/Utils";
6
- export * from "./Structures/Filters";
7
- export * from "./Structures/Rest";
8
- export * from "./Utils/FiltersEqualizers";
9
- export * from "./Utils/ManagerCheck";
10
- export * from "./Utils/NodeCheck";
11
- export * from "./Utils/PlayerCheck";