types(Voice): move types to the library's definitions (#6041)

* types(Voice): move types to d.js

* types: added padding lines

Co-authored-by: Noel <buechler.noel@outlook.com>

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
Antonio Román
2021-07-04 22:10:33 +02:00
committed by GitHub
parent a7c6678c72
commit 185e37602b

54
typings/index.d.ts vendored
View File

@@ -152,25 +152,6 @@ declare enum WebhookTypes {
type Awaited<T> = T | PromiseLike<T>; type Awaited<T> = T | PromiseLike<T>;
declare module '@discordjs/voice' {
import { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from 'discord-api-types/v8';
export interface DiscordGatewayAdapterLibraryMethods {
onVoiceServerUpdate(data: GatewayVoiceServerUpdateDispatchData): void;
onVoiceStateUpdate(data: GatewayVoiceStateUpdateDispatchData): void;
destroy(): void;
}
export interface DiscordGatewayAdapterImplementerMethods {
sendPayload(payload: any): boolean;
destroy(): void;
}
export type DiscordGatewayAdapterCreator = (
methods: DiscordGatewayAdapterLibraryMethods,
) => DiscordGatewayAdapterImplementerMethods;
}
declare module 'discord.js' { declare module 'discord.js' {
import { import {
blockQuote, blockQuote,
@@ -188,7 +169,6 @@ declare module 'discord.js' {
underscore, underscore,
} from '@discordjs/builders'; } from '@discordjs/builders';
import BaseCollection from '@discordjs/collection'; import BaseCollection from '@discordjs/collection';
import { DiscordGatewayAdapterCreator, DiscordGatewayAdapterLibraryMethods } from '@discordjs/voice';
import { ChildProcess } from 'child_process'; import { ChildProcess } from 'child_process';
import { import {
APIActionRowComponent, APIActionRowComponent,
@@ -201,6 +181,8 @@ declare module 'discord.js' {
APIPartialEmoji, APIPartialEmoji,
APIRole, APIRole,
APIUser, APIUser,
GatewayVoiceServerUpdateDispatchData,
GatewayVoiceStateUpdateDispatchData,
Snowflake as APISnowflake, Snowflake as APISnowflake,
} from 'discord-api-types/v8'; } from 'discord-api-types/v8';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
@@ -536,7 +518,7 @@ declare module 'discord.js' {
export class ClientVoiceManager { export class ClientVoiceManager {
constructor(client: Client); constructor(client: Client);
public readonly client: Client; public readonly client: Client;
public adapters: Map<Snowflake, DiscordGatewayAdapterLibraryMethods>; public adapters: Map<Snowflake, InternalDiscordGatewayAdapterLibraryMethods>;
} }
export abstract class Collector<K, V, F extends any[] = []> extends EventEmitter { export abstract class Collector<K, V, F extends any[] = []> extends EventEmitter {
@@ -909,7 +891,7 @@ declare module 'discord.js' {
public systemChannelFlags: Readonly<SystemChannelFlags>; public systemChannelFlags: Readonly<SystemChannelFlags>;
public systemChannelId: Snowflake | null; public systemChannelId: Snowflake | null;
public vanityURLUses: number | null; public vanityURLUses: number | null;
public readonly voiceAdapterCreator: DiscordGatewayAdapterCreator; public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
public readonly voiceStates: VoiceStateManager; public readonly voiceStates: VoiceStateManager;
public readonly widgetChannel: TextChannel | null; public readonly widgetChannel: TextChannel | null;
public widgetChannelId: Snowflake | null; public widgetChannelId: Snowflake | null;
@@ -4496,4 +4478,32 @@ declare module 'discord.js' {
: { [K in keyof T]: Serialized<T[K]> }; : { [K in keyof T]: Serialized<T[K]> };
//#endregion //#endregion
//#region voice
/**
* @internal Use `DiscordGatewayAdapterLibraryMethods` from `@discordjs/voice` instead.
*/
interface InternalDiscordGatewayAdapterLibraryMethods {
onVoiceServerUpdate(data: GatewayVoiceServerUpdateDispatchData): void;
onVoiceStateUpdate(data: GatewayVoiceStateUpdateDispatchData): void;
destroy(): void;
}
/**
* @internal Use `DiscordGatewayAdapterImplementerMethods` from `@discordjs/voice` instead.
*/
interface InternalDiscordGatewayAdapterImplementerMethods {
sendPayload(payload: any): boolean;
destroy(): void;
}
/**
* @internal Use `DiscordGatewayAdapterCreator` from `@discordjs/voice` instead.
*/
type InternalDiscordGatewayAdapterCreator = (
methods: InternalDiscordGatewayAdapterLibraryMethods,
) => InternalDiscordGatewayAdapterImplementerMethods;
//#endregion
} }