This repository was archived by the owner on Nov 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathManager.ts
68 lines (56 loc) · 1.53 KB
/
Manager.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import Collection from "@discordjs/collection";
import EventEmitter from "events";
import type { Player } from "./Player";
/**
* The base options to provide for a audio provider.
*/
export interface ManagerOptions {
/**
* A list of plugins to use with the audio provider, these may be specific for an audio provider.
*/
readonly plugins?: Plugin[]
}
/**
* The base Manager
*/
export interface Manager<O extends ManagerOptions, P extends Player<any, any>> extends EventEmitter {
/**
* The options provided to this manager.
*/
readonly options: O;
/**
* All the players that were created by this manager.
*/
readonly players: Collection<string, P>;
/**
* Adds a plugin
* @param plugin Plugin
*/
use(plugin: Plugin): void;
/**
* Adds an array of plugins
* @param plugins The plugins to use in this manager
*/
use(plugins: Plugin[]): void;
/**
* Creates a Player with the provided Guild ID, `textChannel` and `voiceChannel` must be bound later.
*/
create(guild: string): P;
// /**
// * Creates a Player with the provided Guild and Voice channel ID, `textChannel` must be bound later.
// */
// create(guild: string, channel: string): P;
/**
* Creates a Player with the provided player options.
*/
create(options: ExtractPlayerOptions<P>): P;
/**
* Destroys a Player using the Guild ID.
*/
destroy(guild: string): void;
/**
* Destroys a Player using the Player instance.
*/
destroy(player: P): void;
}
type ExtractPlayerOptions<P> = P extends Player<Manager<any, any>, infer O> ? O : never;