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.
@@ -0,0 +1,250 @@
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
+ }