Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better code comments + intellisense for Lavalink structures #183

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ export abstract class TypedEventEmitter<T extends Record<string, unknown[]>> ext

export type Constructor<T> = new (...args: unknown[]) => T;

export type OmitNested<I extends object, K extends keyof I, T extends keyof NonNullable<I[K]>> = {
[key in keyof I]: key extends K ? Omit<I[key], T> : I[key];
};

// https://github.com/microsoft/TypeScript/issues/43505#issuecomment-1686128430
export type NumericRange<
start extends number,
end extends number,
arr extends unknown[] = [],
acc extends number = never
> = arr['length'] extends end
? acc | start | end
: NumericRange<start, end, [...arr, 1], arr[start] extends undefined ? acc : acc | arr['length']>;

/**
* Merge the default options to user input
* @param def Default options
Expand Down
23 changes: 23 additions & 0 deletions src/guild/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,43 @@ import { Shoukaku, VoiceChannelOptions } from '../Shoukaku';

/**
* Represents the partial payload from a stateUpdate event
* @see https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface StateUpdatePartial {
/**
* Channel ID the state update is for
*/
channel_id?: string;
/**
* Session ID the state update is for
*/
session_id?: string;
/**
* Whether this user is locally deafened
*/
self_deaf: boolean;
/**
* Whether this user is locally muted
*/
self_mute: boolean;
}

/**
* Represents the payload from a serverUpdate event
* @see https://discord.com/developers/docs/topics/gateway-events#voice-server-update
*/
export interface ServerUpdate {
/**
* Voice connection token
*/
token: string;
/**
* Guild this voice server update is for
*/
guild_id: string;
/**
* Voice server hostname
*/
endpoint: string;
}

Expand Down
Loading
Loading