Skip to content

Commit

Permalink
chore(Release): 3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
skick1234 committed Dec 14, 2021
2 parents 823c39d + 5c7ea9e commit db93616
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ A Discord.js module to simplify your music commands and play songs with audio fi
## Installation

```npm
npm install distube
npm install distube@latest
```

### Requirement
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "distube",
"version": "3.0.3",
"version": "3.0.4",
"description": "A Discord.js module to simplify your music commands and play songs with audio filters on Discord without any API key. Support YouTube, SoundCloud, Bandcamp, Facebook, and 700+ more sites",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/core/__test__/DisTubeOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ test("Validate DisTubeOptions", () => {
const n: any = NaN;
expect(() => {
new Options(n);
}).toThrow("Expected 'object' for 'DisTubeOptions', but got NaN");
}).toThrow("Expected 'object' for 'DisTubeOptions', but got null (Number)");
for (const key of Object.keys(defaultOptions).filter(o => o !== "plugins")) {
const options = {};
options[key] = n;
expect(() => {
new Options(options);
}).toThrow(`Expected '${typeof defaultOptions[key]}' for 'DisTubeOptions.${key}', but got NaN`);
}).toThrow(`Expected '${typeof defaultOptions[key]}' for 'DisTubeOptions.${key}', but got null (Number)`);
}
expect(() => {
new Options({ plugins: "undefined" as any });
}).toThrow("Expected 'Array<Plugin>' for 'DisTubeOptions.plugins', but got 'undefined'");
}).toThrow("Expected 'Array<Plugin>' for 'DisTubeOptions.plugins', but got \"undefined\" (String)");
expect(() => {
new Options({ youtubeCookie: 1 as any });
}).toThrow("Expected 'string' for 'DisTubeOptions.youtubeCookie', but got 1");
}).toThrow("Expected 'string' for 'DisTubeOptions.youtubeCookie', but got 1 (Number)");
expect(() => {
new Options({ youtubeIdentityToken: {} as any });
}).toThrow("Expected 'string' for 'DisTubeOptions.youtubeIdentityToken', but got Object");
}).toThrow("Expected 'string' for 'DisTubeOptions.youtubeIdentityToken', but got {} (Object)");
expect(() => {
new Options({ invalidKey: "an invalid key" } as any);
}).toThrow("'invalidKey' does not need to be provided in DisTubeOptions");
Expand Down
4 changes: 2 additions & 2 deletions src/core/manager/QueueManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ export class QueueManager extends BaseManager<Queue> {
return true;
}
if (queue.stopped) return false;
queue.playing = true;
queue.paused = false;
const song = queue.songs[0];
try {
const { url, source, formats, streamURL } = song;
Expand All @@ -163,6 +161,8 @@ export class QueueManager extends BaseManager<Queue> {
const stream = this.handler.createStream(queue);
queue.voice.play(stream);
song.streamURL = stream.url;
if (queue.stopped) queue.stop();
else if (queue.paused) queue.voice.pause();
return false;
} catch (e: any) {
this._handlePlayingError(queue, e);
Expand Down
10 changes: 1 addition & 9 deletions src/struct/DisTubeError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ const ERROR_MESSAGES = {
INVALID_TYPE: (expected: (number | string) | readonly (number | string)[], got: any, name?: string) =>
`Expected ${
Array.isArray(expected) ? expected.map(e => (typeof e === "number" ? e : `'${e}'`)).join(" or ") : `'${expected}'`
}${name ? ` for '${name}'` : ""}, but got ${
typeof got === "string"
? `'${got}'`
: typeof got === "number"
? got
: Array.isArray(got)
? `Array<${got.length}>`
: got?.constructor?.name || typeof got
} (${typeof got})`,
}${name ? ` for '${name}'` : ""}, but got ${JSON.stringify(got)} (${got?.constructor?.name ?? typeof got})`,
NUMBER_COMPARE: (name: string, expected: string, value: number) => `'${name}' must be ${expected} ${value}`,
EMPTY_ARRAY: (name: string) => `'${name}' is an empty array`,
EMPTY_FILTERED_ARRAY: (name: string, type: string) => `There is no valid '${type}' in the '${name}' array`,
Expand Down

0 comments on commit db93616

Please sign in to comment.