mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
types(voice): bring back typed events (#8109)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/method-signature-style */
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from 'discord-api-types/v10';
|
||||
import type { CreateVoiceConnectionOptions } from '.';
|
||||
@@ -161,6 +162,32 @@ export type VoiceConnectionState =
|
||||
| VoiceConnectionReadyState
|
||||
| VoiceConnectionDestroyedState;
|
||||
|
||||
export interface VoiceConnection extends EventEmitter {
|
||||
/**
|
||||
* Emitted when there is an error emitted from the voice connection
|
||||
* @event
|
||||
*/
|
||||
on(event: 'error', listener: (error: Error) => void): this;
|
||||
/**
|
||||
* Emitted debugging information about the voice connection
|
||||
* @event
|
||||
*/
|
||||
on(event: 'debug', listener: (message: string) => void): this;
|
||||
/**
|
||||
* Emitted when the state of the voice connection changes
|
||||
* @event
|
||||
*/
|
||||
on(event: 'stateChange', listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState) => void): this;
|
||||
/**
|
||||
* Emitted when the state of the voice connection changes to a specific status
|
||||
* @event
|
||||
*/
|
||||
on<T extends VoiceConnectionStatus>(
|
||||
event: T,
|
||||
listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState & { status: T }) => void,
|
||||
): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A connection to the voice server of a Guild, can be used to play audio in voice channels.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user