DiscordPHP-Voice Documentation

VoicePayload extends Payload
in package

Represents a Gateway event payload with a voice token.

Gateway event payloads have a common structure, but the contents of the associated data (d) varies between the different events.

Tags
link
https://discord.com/developers/docs/topics/voice-connections#retrieving-voice-server-information-example-voice-server-update-payload
@property

token

todo

Next major release: override fromArray(), inherited from Payload, to return a VoicePayload; it currently builds a plain Payload. Not before, because this class is not final and a subclass already overriding fromArray() with : Payload would fail to load.

Table of Contents

Properties

$token  : string|null

Methods

__construct()  : mixed
__debugInfo()  : mixed
getToken()  : string|null
The voice token, or null when unset.
jsonSerialize()  : array<string|int, mixed>
new()  : self
setToken()  : $this
Sets the voice token merged into `d.token` when the payload is serialised.

Properties

Methods

__construct()

public __construct(int $op[, mixed $d = null ][, int|null $s = null ][, string|null $t = null ][, string|null $token = null ]) : mixed
Parameters
$op : int

Gateway opcode.

$d : mixed = null

Event data payload.

$s : int|null = null

Sequence number.

$t : string|null = null

Event name.

$token : string|null = null

Voice connection token, merged into d.token on serialisation.

__debugInfo()

public __debugInfo() : mixed
Tags
inheritDoc

Redacts the voice token.

getToken()

The voice token, or null when unset.

public getToken() : string|null
Return values
string|null

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Tags
inheritDoc

Adds the voice token under d when one is set.

Return values
array<string|int, mixed>

new()

public static new(int $op[, mixed $d = null ][, int|null $s = null ][, string|null $t = null ][, string|null $token = null ]) : self
Parameters
$op : int
$d : mixed = null
$s : int|null = null
$t : string|null = null
$token : string|null = null
Tags
inheritDoc
Return values
self

setToken()

Sets the voice token merged into `d.token` when the payload is serialised.

public setToken([string|null $token = null ]) : $this
Parameters
$token : string|null = null
Return values
$this
On this page

Search results