distube 4.0.3 → 4.0.4
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/README.md +1 -1
- package/dist/index.d.ts +66 -65
- package/dist/index.js +593 -552
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ytdl from '@distube/ytdl-core';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
3
|
import { GuildTextBasedChannel, Message, Snowflake, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, Client, Collection, ClientOptions } from 'discord.js';
|
|
4
|
+
import ytpl from '@distube/ytpl';
|
|
4
5
|
import { Video, Playlist as Playlist$1 } from '@distube/ytsr';
|
|
5
6
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
6
7
|
import { AudioPlayer, VoiceConnection, AudioResource, StreamType as StreamType$1 } from '@discordjs/voice';
|
|
@@ -13,24 +14,6 @@ declare type DisTubeVoiceEvents = {
|
|
|
13
14
|
error: (error: Error) => Awaitable;
|
|
14
15
|
finish: () => Awaitable;
|
|
15
16
|
};
|
|
16
|
-
declare enum Events {
|
|
17
|
-
ERROR = "error",
|
|
18
|
-
ADD_LIST = "addList",
|
|
19
|
-
ADD_SONG = "addSong",
|
|
20
|
-
PLAY_SONG = "playSong",
|
|
21
|
-
FINISH_SONG = "finishSong",
|
|
22
|
-
EMPTY = "empty",
|
|
23
|
-
FINISH = "finish",
|
|
24
|
-
INIT_QUEUE = "initQueue",
|
|
25
|
-
NO_RELATED = "noRelated",
|
|
26
|
-
DISCONNECT = "disconnect",
|
|
27
|
-
DELETE_QUEUE = "deleteQueue",
|
|
28
|
-
SEARCH_CANCEL = "searchCancel",
|
|
29
|
-
SEARCH_NO_RESULT = "searchNoResult",
|
|
30
|
-
SEARCH_DONE = "searchDone",
|
|
31
|
-
SEARCH_INVALID_ANSWER = "searchInvalidAnswer",
|
|
32
|
-
SEARCH_RESULT = "searchResult"
|
|
33
|
-
}
|
|
34
17
|
declare type DisTubeEvents = {
|
|
35
18
|
error: [channel: GuildTextBasedChannel | undefined, error: Error];
|
|
36
19
|
addList: [queue: Queue, playlist: Playlist];
|
|
@@ -81,7 +64,7 @@ interface DisTubeOptions {
|
|
|
81
64
|
}
|
|
82
65
|
declare type GuildIdResolvable = Queue | DisTubeVoice | Snowflake | Message | GuildTextBasedChannel | VoiceBasedChannel | VoiceState | Guild | GuildMember | Interaction | string;
|
|
83
66
|
interface OtherSongInfo {
|
|
84
|
-
src
|
|
67
|
+
src: string;
|
|
85
68
|
id?: string;
|
|
86
69
|
title?: string;
|
|
87
70
|
name?: string;
|
|
@@ -163,6 +146,24 @@ declare enum StreamType {
|
|
|
163
146
|
OPUS = 0,
|
|
164
147
|
RAW = 1
|
|
165
148
|
}
|
|
149
|
+
declare enum Events {
|
|
150
|
+
ERROR = "error",
|
|
151
|
+
ADD_LIST = "addList",
|
|
152
|
+
ADD_SONG = "addSong",
|
|
153
|
+
PLAY_SONG = "playSong",
|
|
154
|
+
FINISH_SONG = "finishSong",
|
|
155
|
+
EMPTY = "empty",
|
|
156
|
+
FINISH = "finish",
|
|
157
|
+
INIT_QUEUE = "initQueue",
|
|
158
|
+
NO_RELATED = "noRelated",
|
|
159
|
+
DISCONNECT = "disconnect",
|
|
160
|
+
DELETE_QUEUE = "deleteQueue",
|
|
161
|
+
SEARCH_CANCEL = "searchCancel",
|
|
162
|
+
SEARCH_NO_RESULT = "searchNoResult",
|
|
163
|
+
SEARCH_DONE = "searchDone",
|
|
164
|
+
SEARCH_INVALID_ANSWER = "searchInvalidAnswer",
|
|
165
|
+
SEARCH_RESULT = "searchResult"
|
|
166
|
+
}
|
|
166
167
|
|
|
167
168
|
declare const defaultFilters: Filters;
|
|
168
169
|
declare const defaultOptions: {
|
|
@@ -320,7 +321,7 @@ declare class Song<T = unknown> {
|
|
|
320
321
|
age_restricted: boolean;
|
|
321
322
|
chapters: Chapter[];
|
|
322
323
|
reposts: number;
|
|
323
|
-
constructor(info: ytdl.videoInfo | SearchResult | OtherSongInfo | ytdl.relatedVideo | RelatedSong, options?: {
|
|
324
|
+
constructor(info: ytdl.videoInfo | SearchResult | OtherSongInfo | ytdl.relatedVideo | RelatedSong | ytpl.result["items"][number], options?: {
|
|
324
325
|
member?: GuildMember;
|
|
325
326
|
source?: string;
|
|
326
327
|
metadata?: T;
|
|
@@ -377,45 +378,6 @@ declare class DisTubeVoice extends TypedEmitter<DisTubeVoiceEvents> {
|
|
|
377
378
|
get voiceState(): VoiceState | undefined;
|
|
378
379
|
}
|
|
379
380
|
|
|
380
|
-
declare abstract class BaseManager<V> extends DisTubeBase {
|
|
381
|
-
collection: Collection<string, V>;
|
|
382
|
-
get size(): number;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
declare abstract class GuildIdManager<V> extends BaseManager<V> {
|
|
386
|
-
add(idOrInstance: GuildIdResolvable, data: V): this | _discordjs_collection.Collection<string, V>;
|
|
387
|
-
get(idOrInstance: GuildIdResolvable): V | undefined;
|
|
388
|
-
remove(idOrInstance: GuildIdResolvable): boolean;
|
|
389
|
-
has(idOrInstance: GuildIdResolvable): boolean;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
declare class DisTubeVoiceManager extends GuildIdManager<DisTubeVoice> {
|
|
393
|
-
create(channel: VoiceBasedChannel): DisTubeVoice;
|
|
394
|
-
join(channel: VoiceBasedChannel): Promise<DisTubeVoice>;
|
|
395
|
-
leave(guild: GuildIdResolvable): void;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
declare class FilterManager extends BaseManager<FilterResolvable> {
|
|
399
|
-
#private;
|
|
400
|
-
queue: Queue;
|
|
401
|
-
constructor(queue: Queue);
|
|
402
|
-
add(filterOrFilters: FilterResolvable | FilterResolvable[], override?: boolean): this;
|
|
403
|
-
clear(): this;
|
|
404
|
-
set(filters: FilterResolvable[]): this;
|
|
405
|
-
remove(filterOrFilters: FilterResolvable | FilterResolvable[]): this;
|
|
406
|
-
has(filter: FilterResolvable): boolean;
|
|
407
|
-
get names(): string[];
|
|
408
|
-
get values(): string[];
|
|
409
|
-
toString(): string;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
declare class QueueManager extends GuildIdManager<Queue> {
|
|
413
|
-
#private;
|
|
414
|
-
create(channel: VoiceBasedChannel, song: Song[] | Song, textChannel?: GuildTextBasedChannel): Promise<Queue | true>;
|
|
415
|
-
createStream(queue: Queue): DisTubeStream;
|
|
416
|
-
playSong(queue: Queue): Promise<boolean>;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
381
|
declare class DisTubeHandler extends DisTubeBase {
|
|
420
382
|
constructor(distube: DisTube);
|
|
421
383
|
get ytdlOptions(): ytdl.getInfoOptions;
|
|
@@ -475,6 +437,45 @@ declare class DisTubeStream {
|
|
|
475
437
|
constructor(url: string, options: StreamOptions);
|
|
476
438
|
}
|
|
477
439
|
|
|
440
|
+
declare abstract class BaseManager<V> extends DisTubeBase {
|
|
441
|
+
collection: Collection<string, V>;
|
|
442
|
+
get size(): number;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
declare abstract class GuildIdManager<V> extends BaseManager<V> {
|
|
446
|
+
add(idOrInstance: GuildIdResolvable, data: V): this | _discordjs_collection.Collection<string, V>;
|
|
447
|
+
get(idOrInstance: GuildIdResolvable): V | undefined;
|
|
448
|
+
remove(idOrInstance: GuildIdResolvable): boolean;
|
|
449
|
+
has(idOrInstance: GuildIdResolvable): boolean;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class DisTubeVoiceManager extends GuildIdManager<DisTubeVoice> {
|
|
453
|
+
create(channel: VoiceBasedChannel): DisTubeVoice;
|
|
454
|
+
join(channel: VoiceBasedChannel): Promise<DisTubeVoice>;
|
|
455
|
+
leave(guild: GuildIdResolvable): void;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare class FilterManager extends BaseManager<FilterResolvable> {
|
|
459
|
+
#private;
|
|
460
|
+
queue: Queue;
|
|
461
|
+
constructor(queue: Queue);
|
|
462
|
+
add(filterOrFilters: FilterResolvable | FilterResolvable[], override?: boolean): this;
|
|
463
|
+
clear(): this;
|
|
464
|
+
set(filters: FilterResolvable[]): this;
|
|
465
|
+
remove(filterOrFilters: FilterResolvable | FilterResolvable[]): this;
|
|
466
|
+
has(filter: FilterResolvable): boolean;
|
|
467
|
+
get names(): string[];
|
|
468
|
+
get values(): string[];
|
|
469
|
+
toString(): string;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
declare class QueueManager extends GuildIdManager<Queue> {
|
|
473
|
+
#private;
|
|
474
|
+
create(channel: VoiceBasedChannel, song: Song[] | Song, textChannel?: GuildTextBasedChannel): Promise<Queue | true>;
|
|
475
|
+
createStream(queue: Queue): DisTubeStream;
|
|
476
|
+
playSong(queue: Queue): Promise<boolean>;
|
|
477
|
+
}
|
|
478
|
+
|
|
478
479
|
declare class Queue extends DisTubeBase {
|
|
479
480
|
#private;
|
|
480
481
|
readonly id: Snowflake;
|
|
@@ -591,12 +592,6 @@ declare class DisTube extends TypedEmitter<TypedDisTubeEvents> {
|
|
|
591
592
|
get version(): string;
|
|
592
593
|
play(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: PlayOptions): Promise<void>;
|
|
593
594
|
createCustomPlaylist(songs: (string | Song | SearchResult)[], options?: CustomPlaylistOptions): Promise<Playlist>;
|
|
594
|
-
search(string: string, options?: {
|
|
595
|
-
type?: SearchResultType;
|
|
596
|
-
limit?: number;
|
|
597
|
-
safeSearch?: boolean;
|
|
598
|
-
retried?: boolean;
|
|
599
|
-
}): Promise<Array<SearchResult>>;
|
|
600
595
|
search(string: string, options?: {
|
|
601
596
|
type?: SearchResultType.VIDEO;
|
|
602
597
|
limit?: number;
|
|
@@ -609,6 +604,12 @@ declare class DisTube extends TypedEmitter<TypedDisTubeEvents> {
|
|
|
609
604
|
safeSearch?: boolean;
|
|
610
605
|
retried?: boolean;
|
|
611
606
|
}): Promise<Array<SearchResultPlaylist>>;
|
|
607
|
+
search(string: string, options?: {
|
|
608
|
+
type?: SearchResultType;
|
|
609
|
+
limit?: number;
|
|
610
|
+
safeSearch?: boolean;
|
|
611
|
+
retried?: boolean;
|
|
612
|
+
}): Promise<Array<SearchResult>>;
|
|
612
613
|
getQueue(guild: GuildIdResolvable): Queue | undefined;
|
|
613
614
|
pause(guild: GuildIdResolvable): Queue;
|
|
614
615
|
resume(guild: GuildIdResolvable): Queue;
|