discord-player 5.3.0-dev.1 → 5.3.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.
@@ -1,125 +1,133 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Util = void 0;
27
- class Util {
28
- /**
29
- * Utils
30
- */
31
- constructor() { } // eslint-disable-line @typescript-eslint/no-empty-function
32
- /**
33
- * Creates duration string
34
- * @param {object} durObj The duration object
35
- * @returns {string}
36
- */
37
- static durationString(durObj) {
38
- return Object.values(durObj)
39
- .map((m) => (isNaN(m) ? 0 : m))
40
- .join(":");
41
- }
42
- /**
43
- * Parses milliseconds to consumable time object
44
- * @param {number} milliseconds The time in ms
45
- * @returns {TimeData}
46
- */
47
- static parseMS(milliseconds) {
48
- const round = milliseconds > 0 ? Math.floor : Math.ceil;
49
- return {
50
- days: round(milliseconds / 86400000),
51
- hours: round(milliseconds / 3600000) % 24,
52
- minutes: round(milliseconds / 60000) % 60,
53
- seconds: round(milliseconds / 1000) % 60
54
- };
55
- }
56
- /**
57
- * Builds time code
58
- * @param {TimeData} duration The duration object
59
- * @returns {string}
60
- */
61
- static buildTimeCode(duration) {
62
- const items = Object.keys(duration);
63
- const required = ["days", "hours", "minutes", "seconds"];
64
- const parsed = items.filter((x) => required.includes(x)).map((m) => duration[m]);
65
- const final = parsed
66
- .slice(parsed.findIndex((x) => x !== 0))
67
- .map((x) => x.toString().padStart(2, "0"))
68
- .join(":");
69
- return final.length <= 3 ? `0:${final.padStart(2, "0") || 0}` : final;
70
- }
71
- /**
72
- * Picks last item of the given array
73
- * @param {any[]} arr The array
74
- * @returns {any}
75
- */
76
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
- static last(arr) {
78
- if (!Array.isArray(arr))
79
- return;
80
- return arr[arr.length - 1];
81
- }
82
- /**
83
- * Checks if the voice channel is empty
84
- * @param {VoiceChannel|StageChannel} channel The voice channel
85
- * @returns {boolean}
86
- */
87
- static isVoiceEmpty(channel) {
88
- return channel.members.filter((member) => !member.user.bot).size === 0;
89
- }
90
- /**
91
- * Safer require
92
- * @param {string} id Node require id
93
- * @returns {any}
94
- */
95
- static require(id) {
96
- try {
97
- return require(id);
98
- }
99
- catch {
100
- return null;
101
- }
102
- }
103
- /**
104
- * Asynchronous timeout
105
- * @param {number} time The time in ms to wait
106
- * @returns {Promise<unknown>}
107
- */
108
- static wait(time) {
109
- return new Promise((r) => setTimeout(r, time).unref());
110
- }
111
- static noop() { } // eslint-disable-line @typescript-eslint/no-empty-function
112
- static async getFetch() {
113
- if ("fetch" in globalThis)
114
- return globalThis.fetch;
115
- for (const lib of ["undici", "node-fetch"]) {
116
- try {
117
- return await Promise.resolve().then(() => __importStar(require(lib))).then((res) => res.fetch || res.default?.fetch || res.default);
118
- }
119
- catch {
120
- // uh?
121
- }
122
- }
123
- }
124
- }
125
- exports.Util = Util;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Util = void 0;
27
+ class Util {
28
+ /**
29
+ * Utils
30
+ */
31
+ constructor() { } // eslint-disable-line @typescript-eslint/no-empty-function
32
+ /**
33
+ * Creates duration string
34
+ * @param {object} durObj The duration object
35
+ * @returns {string}
36
+ */
37
+ static durationString(durObj) {
38
+ return Object.values(durObj)
39
+ .map((m) => (isNaN(m) ? 0 : m))
40
+ .join(":");
41
+ }
42
+ /**
43
+ * Parses milliseconds to consumable time object
44
+ * @param {number} milliseconds The time in ms
45
+ * @returns {TimeData}
46
+ */
47
+ static parseMS(milliseconds) {
48
+ const round = milliseconds > 0 ? Math.floor : Math.ceil;
49
+ return {
50
+ days: round(milliseconds / 86400000),
51
+ hours: round(milliseconds / 3600000) % 24,
52
+ minutes: round(milliseconds / 60000) % 60,
53
+ seconds: round(milliseconds / 1000) % 60
54
+ };
55
+ }
56
+ /**
57
+ * Builds time code
58
+ * @param {TimeData} duration The duration object
59
+ * @returns {string}
60
+ */
61
+ static buildTimeCode(duration) {
62
+ const items = Object.keys(duration);
63
+ const required = ["days", "hours", "minutes", "seconds"];
64
+ const parsed = items.filter((x) => required.includes(x)).map((m) => duration[m]);
65
+ const final = parsed
66
+ .slice(parsed.findIndex((x) => x !== 0))
67
+ .map((x) => x.toString().padStart(2, "0"))
68
+ .join(":");
69
+ return final.length <= 3 ? `0:${final.padStart(2, "0") || 0}` : final;
70
+ }
71
+ /**
72
+ * Picks last item of the given array
73
+ * @param {any[]} arr The array
74
+ * @returns {any}
75
+ */
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ static last(arr) {
78
+ if (!Array.isArray(arr))
79
+ return;
80
+ return arr[arr.length - 1];
81
+ }
82
+ /**
83
+ * Checks if the voice channel is empty
84
+ * @param {VoiceChannel|StageChannel} channel The voice channel
85
+ * @returns {boolean}
86
+ */
87
+ static isVoiceEmpty(channel) {
88
+ return channel.members.filter((member) => !member.user.bot).size === 0;
89
+ }
90
+ /**
91
+ * Safer require
92
+ * @param {string} id Node require id
93
+ * @returns {any}
94
+ */
95
+ static require(id) {
96
+ try {
97
+ return require(id);
98
+ }
99
+ catch {
100
+ return null;
101
+ }
102
+ }
103
+ /**
104
+ * Asynchronous timeout
105
+ * @param {number} time The time in ms to wait
106
+ * @returns {Promise<unknown>}
107
+ */
108
+ static wait(time) {
109
+ return new Promise((r) => setTimeout(r, time).unref());
110
+ }
111
+ static noop() { } // eslint-disable-line @typescript-eslint/no-empty-function
112
+ static async getFetch() {
113
+ if ("fetch" in globalThis)
114
+ return globalThis.fetch;
115
+ for (const lib of ["undici", "node-fetch"]) {
116
+ try {
117
+ return await Promise.resolve().then(() => __importStar(require(lib))).then((res) => res.fetch || res.default?.fetch || res.default);
118
+ }
119
+ catch {
120
+ try {
121
+ // eslint-disable-next-line
122
+ const res = require(lib);
123
+ if (res)
124
+ return res.fetch || res.default?.fetch || res.default;
125
+ }
126
+ catch {
127
+ // no?
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ exports.Util = Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discord-player",
3
- "version": "5.3.0-dev.1",
3
+ "version": "5.3.0",
4
4
  "description": "Complete framework to facilitate music commands using discord.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,32 +66,31 @@
66
66
  "homepage": "https://discord-player.js.org",
67
67
  "dependencies": {
68
68
  "@discordjs/voice": "^0.11.0",
69
- "discord-ytdl-core": "^5.0.4",
70
69
  "libsodium-wrappers": "^0.7.10",
71
70
  "soundcloud-scraper": "^5.0.3",
72
71
  "spotify-url-info": "^3.1.2",
73
72
  "tiny-typed-emitter": "^2.1.0",
74
73
  "tslib": "^2.4.0",
75
- "youtube-sr": "^4.2.0",
74
+ "youtube-sr": "^4.3.0",
76
75
  "ytdl-core": "^4.11.0"
77
76
  },
78
77
  "devDependencies": {
79
78
  "@discordjs/ts-docgen": "^0.4.1",
80
- "@favware/rollup-type-bundler": "^1.0.9",
81
- "@types/node": "^18.0.6",
79
+ "@favware/rollup-type-bundler": "^1.0.10",
80
+ "@types/node": "^18.6.3",
82
81
  "@types/ws": "^8.5.3",
83
- "@typescript-eslint/eslint-plugin": "^5.30.7",
84
- "@typescript-eslint/parser": "^5.30.7",
85
- "discord-api-types": "^0.36.2",
86
- "discord.js": "^14.0.2",
87
- "eslint": "^8.20.0",
82
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
83
+ "@typescript-eslint/parser": "^5.32.0",
84
+ "discord-api-types": "^0.37.0",
85
+ "discord.js": "^14.1.2",
86
+ "eslint": "^8.21.0",
88
87
  "gen-esm-wrapper": "^1.1.3",
89
88
  "husky": "^8.0.1",
90
89
  "opusscript": "^0.0.8",
91
90
  "prettier": "^2.7.1",
92
91
  "rimraf": "^3.0.2",
93
92
  "ts-node": "^10.9.1",
94
- "typedoc": "^0.23.8",
93
+ "typedoc": "^0.23.10",
95
94
  "typescript": "^4.7.4"
96
95
  }
97
96
  }