discord-player-deezer 0.0.3 → 0.0.5

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.
@@ -7,6 +7,6 @@ export default class DeezerExtractor extends BaseExtractor {
7
7
  private deezerRegex;
8
8
  activate(): Promise<void>;
9
9
  validate(query: string, _type?: SearchQueryType | null | undefined): Promise<boolean>;
10
- handle(query: string, _context: ExtractorSearchContext): Promise<ExtractorInfo>;
10
+ handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
11
11
  stream(info: Track): Promise<string | Readable>;
12
12
  }
@@ -19,9 +19,13 @@ class DeezerExtractor extends discord_player_1.BaseExtractor {
19
19
  }
20
20
  async validate(query, _type) {
21
21
  if (typeof query !== 'string') return false;
22
- return this.deezerRegex.track.test(query) || this.deezerRegex.playlistNalbums.test(query);
22
+ return (
23
+ this.deezerRegex.track.test(query) ||
24
+ this.deezerRegex.playlistNalbums.test(query) ||
25
+ this.deezerRegex.share.test(query)
26
+ );
23
27
  }
24
- async handle(query, _context) {
28
+ async handle(query, context) {
25
29
  const data = await (0, deezer_music_metadata_1.getData)(query);
26
30
  if (data?.type === 'song') {
27
31
  const returnData = {
@@ -37,6 +41,7 @@ class DeezerExtractor extends discord_player_1.BaseExtractor {
37
41
  thumbnail: data.thumbnail[0].url,
38
42
  duration: discord_player_1.Util.buildTimeCode(discord_player_1.Util.parseMS(data.duration * 1000)),
39
43
  views: 0,
44
+ requestedBy: context.requestedBy,
40
45
  }),
41
46
  ],
42
47
  };
@@ -71,6 +76,7 @@ class DeezerExtractor extends discord_player_1.BaseExtractor {
71
76
  thumbnail: track.thumbnail[0].url,
72
77
  duration: discord_player_1.Util.buildTimeCode(discord_player_1.Util.parseMS(track.duration * 1000)),
73
78
  views: 0,
79
+ requestedBy: context.requestedBy,
74
80
  });
75
81
  });
76
82
  playlist.tracks = tracks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discord-player-deezer",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "A custom extractor made for discord-player that enables you to extract from Deezer.",
5
5
  "main": "dist/DeezerExtractor.js",
6
6
  "author": "retro_ig",
package/readme.md CHANGED
@@ -5,13 +5,11 @@ Discord Player Deezer Extractor. An unofficial extractor made for discord-player
5
5
  ## Installing the extractor
6
6
 
7
7
  ```bash
8
- npm install https://github.com/retrouser955/discord-player-deezer.git
8
+ npm install discord-player-deezer
9
9
  # or
10
- yarn add https://github.com/retrouser955/discord-player-deezer.git
10
+ yarn add discord-player-deezer
11
11
  ```
12
12
 
13
- *note: I will put the extractor on npm once I am done with the package!*
14
-
15
13
  ## Loading the extractor
16
14
 
17
15
  ```js
@@ -29,10 +29,10 @@ export default class DeezerExtractor extends BaseExtractor {
29
29
  public async validate(query: string, _type?: SearchQueryType | null | undefined): Promise<boolean> {
30
30
  if (typeof query !== "string") return false
31
31
 
32
- return this.deezerRegex.track.test(query) || this.deezerRegex.playlistNalbums.test(query)
32
+ return this.deezerRegex.track.test(query) || this.deezerRegex.playlistNalbums.test(query) || this.deezerRegex.share.test(query)
33
33
  }
34
34
 
35
- public async handle(query: string, _context: ExtractorSearchContext): Promise<ExtractorInfo> {
35
+ public async handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo> {
36
36
  const data = await getData(query)
37
37
 
38
38
  if (data?.type === "song") {
@@ -48,7 +48,8 @@ export default class DeezerExtractor extends BaseExtractor {
48
48
  source: "arbitrary",
49
49
  thumbnail: data.thumbnail[0].url,
50
50
  duration: Util.buildTimeCode(Util.parseMS(data.duration * 1000)),
51
- views: 0
51
+ views: 0,
52
+ requestedBy: context.requestedBy
52
53
  })
53
54
  ]
54
55
  }
@@ -86,7 +87,8 @@ export default class DeezerExtractor extends BaseExtractor {
86
87
  source: "arbitrary",
87
88
  thumbnail: track.thumbnail[0].url,
88
89
  duration: Util.buildTimeCode(Util.parseMS(track.duration * 1000)),
89
- views: 0
90
+ views: 0,
91
+ requestedBy: context.requestedBy
90
92
  })
91
93
  })
92
94