discord-player-deezer 2.2.1-dev.1 → 2.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.
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ declare class DeezerExtractor extends BaseExtractor<DeezerExtractorOptions> {
30
30
  static identifier: string;
31
31
  userInfo: DeezerUserInfo;
32
32
  activate(): Promise<void>;
33
+ deactivate(): Promise<void>;
33
34
  validate(query: string, type: SearchQueryType & "deezer"): Promise<boolean>;
34
35
  buildPlaylistData(data: Playlist, handleContext: ExtractorSearchContext): Playlist$1;
35
36
  handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
@@ -39,7 +40,7 @@ declare class DeezerExtractor extends BaseExtractor<DeezerExtractorOptions> {
39
40
  }
40
41
 
41
42
  declare function getCrypto(): Promise<typeof crypto>;
42
- declare function isUrl(query: string): Promise<boolean>;
43
+ declare function isUrl(query: string): boolean;
43
44
  declare function search(query: string, limit?: number): Promise<DeezerSearchTrackResponse>;
44
45
  type ArrayOrObject<T> = T | T[];
45
46
  interface DeezerSearchTrackResponse {
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ async function getCrypto() {
61
61
  }
62
62
  return rawCrypto;
63
63
  }
64
- async function isUrl(query) {
64
+ function isUrl(query) {
65
65
  try {
66
66
  new URL(query);
67
67
  return true;
@@ -207,6 +207,7 @@ var Warnings = {
207
207
  };
208
208
  var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
209
209
  async activate() {
210
+ this.protocols = ["deezer"];
210
211
  if (!this.options.decryptionKey) process.emitWarning(Warnings.MissingDecryption);
211
212
  else {
212
213
  const crypto = await getCrypto();
@@ -227,6 +228,9 @@ var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
227
228
  this.context.player.debug("USER INFO EXT: " + JSON.stringify(this.userInfo));
228
229
  }
229
230
  }
231
+ async deactivate() {
232
+ this.protocols = [];
233
+ }
230
234
  async validate(query, type) {
231
235
  return validate(query) || type === "deezer";
232
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discord-player-deezer",
3
- "version": "2.2.1-dev.1",
3
+ "version": "2.3.0",
4
4
  "description": "A custom extractor made for discord-player that enables you to extract from Deezer.",
5
5
  "main": "dist/index.js",
6
6
  "author": "retro_ig",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "https://github.com/retrouser955/discord-player-deezer/"
30
+ "url": "git+https://github.com/retrouser955/discord-player-deezer.git"
31
31
  },
32
32
  "bugs": {
33
33
  "url": "https://github.com/retrouser955/discord-player-deezer/issues"
@@ -34,6 +34,7 @@ export class DeezerExtractor extends BaseExtractor<DeezerExtractorOptions> {
34
34
  userInfo!: DeezerUserInfo
35
35
 
36
36
  async activate(): Promise<void> {
37
+ this.protocols = ["deezer"]
37
38
  if(!this.options.decryptionKey) process.emitWarning(Warnings.MissingDecryption)
38
39
  else {
39
40
  // extract deezer username
@@ -62,6 +63,10 @@ export class DeezerExtractor extends BaseExtractor<DeezerExtractorOptions> {
62
63
  }
63
64
  }
64
65
 
66
+ async deactivate() {
67
+ this.protocols = []
68
+ }
69
+
65
70
  async validate(query: string, type: SearchQueryType & "deezer"): Promise<boolean> {
66
71
  return validate(query) || type === "deezer"
67
72
  }
package/src/utils/util.ts CHANGED
@@ -16,7 +16,7 @@ export async function getCrypto() {
16
16
  return rawCrypto
17
17
  }
18
18
 
19
- export async function isUrl(query: string) {
19
+ export function isUrl(query: string) {
20
20
  try {
21
21
  /* tslint:disable-next-line no-unused-expression */
22
22
  new URL(query)