magmastream 2.9.0-dev.17 → 2.9.0-dev.18
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 +1 -9
- package/dist/storage/CollectionPlayerStore.js +4 -1
- package/dist/storage/RedisPlayerStore.js +7 -4
- package/dist/structures/Manager.js +164 -366
- package/dist/structures/Node.js +1 -1
- package/dist/structures/Player.js +5 -12
- package/dist/structures/Queue.js +259 -210
- package/dist/structures/RedisQueue.js +250 -201
- package/dist/structures/Utils.js +0 -56
- package/dist/utils/logExecutionTime.js +11 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1055,12 +1055,6 @@ declare class Manager extends EventEmitter {
|
|
|
1055
1055
|
* @param {string} guildId - The guild ID of the player to save
|
|
1056
1056
|
*/
|
|
1057
1057
|
savePlayerState(guildId: string): Promise<void>;
|
|
1058
|
-
/**
|
|
1059
|
-
* Sleeps for a specified amount of time.
|
|
1060
|
-
* @param ms The amount of time to sleep in milliseconds.
|
|
1061
|
-
* @returns A promise that resolves after the specified amount of time.
|
|
1062
|
-
*/
|
|
1063
|
-
private sleep;
|
|
1064
1058
|
/**
|
|
1065
1059
|
* Loads player states from the JSON file.
|
|
1066
1060
|
* @param nodeId The ID of the node to load player states from.
|
|
@@ -1212,7 +1206,7 @@ interface ManagerOptions {
|
|
|
1212
1206
|
/** The last.fm API key.
|
|
1213
1207
|
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
1214
1208
|
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
1215
|
-
lastFmApiKey
|
|
1209
|
+
lastFmApiKey: string;
|
|
1216
1210
|
/** The maximum number of previous tracks to store. */
|
|
1217
1211
|
maxPreviousTracks?: number;
|
|
1218
1212
|
/** The array of nodes to connect to. */
|
|
@@ -1287,7 +1281,6 @@ declare enum SearchPlatform {
|
|
|
1287
1281
|
Bandcamp = "bcsearch",
|
|
1288
1282
|
Deezer = "dzsearch",
|
|
1289
1283
|
Jiosaavn = "jssearch",
|
|
1290
|
-
Qobuz = "qbsearch",
|
|
1291
1284
|
SoundCloud = "scsearch",
|
|
1292
1285
|
Spotify = "spsearch",
|
|
1293
1286
|
Tidal = "tdsearch",
|
|
@@ -1301,7 +1294,6 @@ declare enum AutoPlayPlatform {
|
|
|
1301
1294
|
SoundCloud = "soundcloud",
|
|
1302
1295
|
Tidal = "tidal",
|
|
1303
1296
|
VKMusic = "vkmusic",
|
|
1304
|
-
Qobuz = "qobuz",
|
|
1305
1297
|
YouTube = "youtube"
|
|
1306
1298
|
}
|
|
1307
1299
|
declare enum PlayerStateEventTypes {
|
|
@@ -3,10 +3,13 @@
|
|
|
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");
|
|
6
7
|
class CollectionPlayerStore {
|
|
7
8
|
store = new collection_1.Collection();
|
|
8
9
|
async get(guildId) {
|
|
9
|
-
return
|
|
10
|
+
return (0, logExecutionTime_1.logExecutionTime)("CollectionStore.get", async () => {
|
|
11
|
+
return this.store.get(guildId);
|
|
12
|
+
});
|
|
10
13
|
}
|
|
11
14
|
async set(guildId, player) {
|
|
12
15
|
this.store.set(guildId, player);
|
|
@@ -2,6 +2,7 @@
|
|
|
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");
|
|
5
6
|
class RedisPlayerStore {
|
|
6
7
|
redis;
|
|
7
8
|
manager;
|
|
@@ -15,10 +16,12 @@ class RedisPlayerStore {
|
|
|
15
16
|
return `${this.prefix}player:${guildId}`;
|
|
16
17
|
}
|
|
17
18
|
async get(guildId) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return (0, logExecutionTime_1.logExecutionTime)("RedisStore.get", async () => {
|
|
20
|
+
const raw = await this.redis.get(this.getKey(guildId));
|
|
21
|
+
if (!raw)
|
|
22
|
+
return undefined;
|
|
23
|
+
return JSON.parse(raw);
|
|
24
|
+
});
|
|
22
25
|
}
|
|
23
26
|
async set(guildId, player) {
|
|
24
27
|
const serialized = this.manager.serializePlayer(player);
|