Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
feat: export some types so they render in docs (#211)
Browse files Browse the repository at this point in the history
Co-authored-by: Noel <icrawltogo@gmail.com>
  • Loading branch information
cherryblossom000 and iCrawl committed Oct 27, 2021
1 parent b9d1038 commit a6dad47
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,20 @@ export function getGroups() {
return groups;
}

/**
* Retrieves all the voice connections under the 'default' group.
* @param group - The group to look up
* @returns The map of voice connections
*/
export function getVoiceConnections(group?: 'default'): Map<string, VoiceConnection>;

/**
* Retrieves all the voice connections under the given group name.
* @param group - The group to look up
* @returns The map of voice connections
*/
export function getVoiceConnections(group: string): Map<string, VoiceConnection> | undefined;

/**
* Retrieves all the voice connections under the given group name. Defaults to the 'default' group.
* @param group - The group to look up
Expand Down
34 changes: 32 additions & 2 deletions src/audio/AudioResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AudioPlayer, SILENCE_FRAME } from './AudioPlayer';
*
* @template T - the type for the metadata (if any) of the audio resource.
*/
interface CreateAudioResourceOptions<T> {
export interface CreateAudioResourceOptions<T> {
/**
* The type of the input stream. Defaults to `StreamType.Arbitrary`.
*/
Expand Down Expand Up @@ -189,6 +189,21 @@ export function inferStreamType(stream: Readable): {
return { streamType: StreamType.Arbitrary, hasVolume: false };
}

/**
* Creates an audio resource that can be played by audio players.
*
* @remarks
* If the input is given as a string, then the inputType option will be overridden and FFmpeg will be used.
*
* If the input is not in the correct format, then a pipeline of transcoders and transformers will be created
* to ensure that the resultant stream is in the correct format for playback. This could involve using FFmpeg,
* Opus transcoders, and Ogg/WebM demuxers.
*
* @param input - The resource to play.
* @param options - Configurable options for creating the resource.
*
* @template T - the type for the metadata (if any) of the audio resource.
*/
export function createAudioResource<T>(
input: string | Readable,
options: CreateAudioResourceOptions<T> &
Expand All @@ -198,13 +213,28 @@ export function createAudioResource<T>(
>,
): AudioResource<T extends null | undefined ? null : T>;

/**
* Creates an audio resource that can be played by audio players.
*
* @remarks
* If the input is given as a string, then the inputType option will be overridden and FFmpeg will be used.
*
* If the input is not in the correct format, then a pipeline of transcoders and transformers will be created
* to ensure that the resultant stream is in the correct format for playback. This could involve using FFmpeg,
* Opus transcoders, and Ogg/WebM demuxers.
*
* @param input - The resource to play.
* @param options - Configurable options for creating the resource.
*
* @template T - the type for the metadata (if any) of the audio resource.
*/
export function createAudioResource<T extends null | undefined>(
input: string | Readable,
options?: Omit<CreateAudioResourceOptions<T>, 'metadata'>,
): AudioResource<null>;

/**
* Creates an audio resource that can be played be audio players.
* Creates an audio resource that can be played by audio players.
*
* @remarks
* If the input is given as a string, then the inputType option will be overridden and FFmpeg will be used.
Expand Down
2 changes: 1 addition & 1 deletion src/audio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export {

export { AudioPlayerError } from './AudioPlayerError';

export { AudioResource, createAudioResource } from './AudioResource';
export { AudioResource, CreateAudioResourceOptions, createAudioResource } from './AudioResource';

export { PlayerSubscription } from './PlayerSubscription';

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export {
VoiceConnectionEvents,
} from './VoiceConnection';

export { getVoiceConnection, getVoiceConnections, getGroups } from './DataStore';
export { JoinConfig, getVoiceConnection, getVoiceConnections, getGroups } from './DataStore';
1 change: 1 addition & 0 deletions src/receive/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './VoiceReceiver';
export * from './SSRCMap';
export * from './AudioReceiveStream';
export * from './SpeakingMap';

0 comments on commit a6dad47

Please sign in to comment.