magmastream 2.9.0-dev.18 → 2.9.0-dev.19
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/dist/index.d.ts +11 -1
- package/dist/storage/CollectionPlayerStore.js +1 -4
- package/dist/storage/RedisPlayerStore.js +4 -7
- package/dist/structures/Manager.js +366 -164
- package/dist/structures/Node.js +5 -8
- package/dist/structures/Player.js +16 -6
- package/dist/structures/Queue.js +213 -259
- package/dist/structures/RedisQueue.js +208 -250
- package/dist/structures/Utils.js +56 -0
- package/package.json +1 -1
- package/dist/utils/logExecutionTime.js +0 -11
package/dist/index.d.ts
CHANGED
|
@@ -593,6 +593,7 @@ declare class Queue extends Array<Track> implements IQueue {
|
|
|
593
593
|
setCurrent(track: Track | null): Promise<void>;
|
|
594
594
|
getPrevious(): Promise<Track[]>;
|
|
595
595
|
addPrevious(track: Track | Track[]): Promise<void>;
|
|
596
|
+
setPrevious(tracks: Track[]): Promise<void>;
|
|
596
597
|
clearPrevious(): Promise<void>;
|
|
597
598
|
/**
|
|
598
599
|
* The total duration of the queue in milliseconds.
|
|
@@ -919,6 +920,7 @@ interface IQueue {
|
|
|
919
920
|
setCurrent(track: Track | null): Promise<void>;
|
|
920
921
|
getPrevious(): Promise<Track[]>;
|
|
921
922
|
addPrevious(track: Track | Track[]): Promise<void>;
|
|
923
|
+
setPrevious(track: Track | Track[]): Promise<void>;
|
|
922
924
|
clearPrevious(): Promise<void>;
|
|
923
925
|
size(): Promise<number>;
|
|
924
926
|
totalSize(): Promise<number>;
|
|
@@ -1055,6 +1057,12 @@ declare class Manager extends EventEmitter {
|
|
|
1055
1057
|
* @param {string} guildId - The guild ID of the player to save
|
|
1056
1058
|
*/
|
|
1057
1059
|
savePlayerState(guildId: string): Promise<void>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Sleeps for a specified amount of time.
|
|
1062
|
+
* @param ms The amount of time to sleep in milliseconds.
|
|
1063
|
+
* @returns A promise that resolves after the specified amount of time.
|
|
1064
|
+
*/
|
|
1065
|
+
private sleep;
|
|
1058
1066
|
/**
|
|
1059
1067
|
* Loads player states from the JSON file.
|
|
1060
1068
|
* @param nodeId The ID of the node to load player states from.
|
|
@@ -1206,7 +1214,7 @@ interface ManagerOptions {
|
|
|
1206
1214
|
/** The last.fm API key.
|
|
1207
1215
|
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
1208
1216
|
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
1209
|
-
lastFmApiKey
|
|
1217
|
+
lastFmApiKey?: string;
|
|
1210
1218
|
/** The maximum number of previous tracks to store. */
|
|
1211
1219
|
maxPreviousTracks?: number;
|
|
1212
1220
|
/** The array of nodes to connect to. */
|
|
@@ -1281,6 +1289,7 @@ declare enum SearchPlatform {
|
|
|
1281
1289
|
Bandcamp = "bcsearch",
|
|
1282
1290
|
Deezer = "dzsearch",
|
|
1283
1291
|
Jiosaavn = "jssearch",
|
|
1292
|
+
Qobuz = "qbsearch",
|
|
1284
1293
|
SoundCloud = "scsearch",
|
|
1285
1294
|
Spotify = "spsearch",
|
|
1286
1295
|
Tidal = "tdsearch",
|
|
@@ -1294,6 +1303,7 @@ declare enum AutoPlayPlatform {
|
|
|
1294
1303
|
SoundCloud = "soundcloud",
|
|
1295
1304
|
Tidal = "tidal",
|
|
1296
1305
|
VKMusic = "vkmusic",
|
|
1306
|
+
Qobuz = "qobuz",
|
|
1297
1307
|
YouTube = "youtube"
|
|
1298
1308
|
}
|
|
1299
1309
|
declare enum PlayerStateEventTypes {
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.CollectionPlayerStore = void 0;
|
|
5
5
|
const collection_1 = require("@discordjs/collection");
|
|
6
|
-
const logExecutionTime_1 = require("../utils/logExecutionTime");
|
|
7
6
|
class CollectionPlayerStore {
|
|
8
7
|
store = new collection_1.Collection();
|
|
9
8
|
async get(guildId) {
|
|
10
|
-
return
|
|
11
|
-
return this.store.get(guildId);
|
|
12
|
-
});
|
|
9
|
+
return this.store.get(guildId);
|
|
13
10
|
}
|
|
14
11
|
async set(guildId, player) {
|
|
15
12
|
this.store.set(guildId, player);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// THIS WILL BE REMOVED IF YOU DONT FIND A USE FOR IT.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.RedisPlayerStore = void 0;
|
|
5
|
-
const logExecutionTime_1 = require("../utils/logExecutionTime");
|
|
6
5
|
class RedisPlayerStore {
|
|
7
6
|
redis;
|
|
8
7
|
manager;
|
|
@@ -16,12 +15,10 @@ class RedisPlayerStore {
|
|
|
16
15
|
return `${this.prefix}player:${guildId}`;
|
|
17
16
|
}
|
|
18
17
|
async get(guildId) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return JSON.parse(raw);
|
|
24
|
-
});
|
|
18
|
+
const raw = await this.redis.get(this.getKey(guildId));
|
|
19
|
+
if (!raw)
|
|
20
|
+
return undefined;
|
|
21
|
+
return JSON.parse(raw);
|
|
25
22
|
}
|
|
26
23
|
async set(guildId, player) {
|
|
27
24
|
const serialized = this.manager.serializePlayer(player);
|