Options
All
  • Public
  • Public/Protected
  • All
Menu

Class VoiceConnection

Hierarchy

  • EventEmitter
    • VoiceConnection

Implements

Index

Constructors

constructor

  • new VoiceConnection(id: string, options?: { opusOnly?: undefined | boolean; shard?: undefined | Shard; shared?: undefined | boolean }): VoiceConnection
  • Parameters

    • id: string
    • Optional options: { opusOnly?: undefined | boolean; shard?: undefined | Shard; shared?: undefined | boolean }
      • Optional opusOnly?: undefined | boolean
      • Optional shard?: undefined | Shard
      • Optional shared?: undefined | boolean

    Returns VoiceConnection

Properties

bitrate

bitrate: number

channelID

channelID: null | string

channels

channels: number

connecting

connecting: boolean

connectionTimeout

connectionTimeout: null | Timeout

Optional current

current: undefined | null | VoiceStreamCurrent

Optional ended

ended: undefined | boolean

endpoint

endpoint: URL

frameDuration

frameDuration: number

frameSize

frameSize: number

heartbeatInterval

heartbeatInterval: null | Timeout

id

id: string

Optional mode

mode: undefined | string

Optional modes

modes: undefined | string

on

opus

opus: {}

Optional dependencies OpusScript (opusscript) or OpusEncoder (@discordjs/opus)

Type declaration

  • [userID: string]: unknown

opusOnly

opusOnly: boolean

paused

paused: boolean

pcmSize

pcmSize: number

piper

piper: Piper

playing

playing: boolean

ready

ready: boolean

Optional receiveStreamOpus

receiveStreamOpus: undefined | null | VoiceDataStream

Optional receiveStreamPCM

receiveStreamPCM: undefined | null | VoiceDataStream

reconnecting

reconnecting: boolean

samplingRate

samplingRate: number

secret

secret: Buffer

sendBuffer

sendBuffer: Buffer

sendNonce

sendNonce: Buffer

sequence

sequence: number

shard

shard: Shard | Record<string, never>

shared

shared: boolean

speaking

speaking: boolean

Optional ssrc

ssrc: undefined | number

ssrcUserMap

ssrcUserMap: {}

Type declaration

  • [s: number]: string

timestamp

timestamp: number

Optional udpIP

udpIP: undefined | string

Optional udpPort

udpPort: undefined | number

udpSocket

udpSocket: null | Socket

volume

volume: number

ws

ws: any

Readonly Static captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Readonly Static errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

connect

  • Parameters

    Returns void | Timer

disconnect

  • disconnect(error?: Error, reconnecting?: boolean): void
  • Parameters

    • Optional error: Error
    • Optional reconnecting: boolean

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

heartbeat

  • heartbeat(): void
  • Returns void

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

once

  • once(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

pause

  • pause(): void
  • Returns void

play

  • Parameters

    Returns void

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

receive

  • Parameters

    • type: "opus" | "pcm"

    Returns VoiceDataStream

registerReceiveEventHandler

  • registerReceiveEventHandler(): void
  • Returns void

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns VoiceConnection

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): VoiceConnection
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns VoiceConnection

resume

  • resume(): void
  • Returns void

sendWS

  • sendWS(op: number, data: Record<string, unknown>): void
  • Parameters

    • op: number
    • data: Record<string, unknown>

    Returns void

setMaxListeners

  • Parameters

    • n: number

    Returns VoiceConnection

setSpeaking

  • setSpeaking(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

setVolume

  • setVolume(volume: number): void
  • Parameters

    • volume: number

    Returns void

stopPlaying

  • stopPlaying(): void
  • Returns void

switchChannel

  • switchChannel(channelID: string): void
  • Parameters

    • channelID: string

    Returns void

toJSON

  • Parameters

    • Optional props: string[]

    Returns JSONCache

updateVoiceState

  • updateVoiceState(selfMute: boolean, selfDeaf: boolean): void
  • Parameters

    • selfMute: boolean
    • selfDeaf: boolean

    Returns void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc