DiscordPHP Documentation

Event
in package
Uses EventEmitterTrait

Contains constants for WebSocket events as well as handlers for the events.

Tags
since
2.1.3

Table of Contents

APPLICATION_COMMAND_PERMISSIONS_UPDATE  = 'APPLICATION_COMMAND_PERMISSIONS_UPDATE'
AUTO_MODERATION_ACTION_EXECUTION  = 'AUTO_MODERATION_ACTION_EXECUTION'
AUTO_MODERATION_RULE_CREATE  = 'AUTO_MODERATION_RULE_CREATE'
AUTO_MODERATION_RULE_DELETE  = 'AUTO_MODERATION_RULE_DELETE'
AUTO_MODERATION_RULE_UPDATE  = 'AUTO_MODERATION_RULE_UPDATE'
CHANNEL_CREATE  = 'CHANNEL_CREATE'
CHANNEL_DELETE  = 'CHANNEL_DELETE'
CHANNEL_PINS_UPDATE  = 'CHANNEL_PINS_UPDATE'
CHANNEL_UPDATE  = 'CHANNEL_UPDATE'
GUILD_AUDIT_LOG_ENTRY_CREATE  = 'GUILD_AUDIT_LOG_ENTRY_CREATE'
GUILD_BAN_ADD  = 'GUILD_BAN_ADD'
GUILD_BAN_REMOVE  = 'GUILD_BAN_REMOVE'
GUILD_CREATE  = 'GUILD_CREATE'
GUILD_DELETE  = 'GUILD_DELETE'
GUILD_EMOJIS_UPDATE  = 'GUILD_EMOJIS_UPDATE'
GUILD_INTEGRATIONS_UPDATE  = 'GUILD_INTEGRATIONS_UPDATE'
GUILD_MEMBER_ADD  = 'GUILD_MEMBER_ADD'
GUILD_MEMBER_REMOVE  = 'GUILD_MEMBER_REMOVE'
GUILD_MEMBER_UPDATE  = 'GUILD_MEMBER_UPDATE'
GUILD_MEMBERS_CHUNK  = 'GUILD_MEMBERS_CHUNK'
GUILD_ROLE_CREATE  = 'GUILD_ROLE_CREATE'
GUILD_ROLE_DELETE  = 'GUILD_ROLE_DELETE'
GUILD_ROLE_UPDATE  = 'GUILD_ROLE_UPDATE'
GUILD_SCHEDULED_EVENT_CREATE  = 'GUILD_SCHEDULED_EVENT_CREATE'
GUILD_SCHEDULED_EVENT_DELETE  = 'GUILD_SCHEDULED_EVENT_DELETE'
GUILD_SCHEDULED_EVENT_UPDATE  = 'GUILD_SCHEDULED_EVENT_UPDATE'
GUILD_SCHEDULED_EVENT_USER_ADD  = 'GUILD_SCHEDULED_EVENT_USER_ADD'
GUILD_SCHEDULED_EVENT_USER_REMOVE  = 'GUILD_SCHEDULED_EVENT_USER_REMOVE'
GUILD_STICKERS_UPDATE  = 'GUILD_STICKERS_UPDATE'
GUILD_UPDATE  = 'GUILD_UPDATE'
INTEGRATION_CREATE  = 'INTEGRATION_CREATE'
INTEGRATION_DELETE  = 'INTEGRATION_DELETE'
INTEGRATION_UPDATE  = 'INTEGRATION_UPDATE'
INTERACTION_CREATE  = 'INTERACTION_CREATE'
INVITE_CREATE  = 'INVITE_CREATE'
INVITE_DELETE  = 'INVITE_DELETE'
MESSAGE_CREATE  = 'MESSAGE_CREATE'
MESSAGE_DELETE  = 'MESSAGE_DELETE'
MESSAGE_DELETE_BULK  = 'MESSAGE_DELETE_BULK'
MESSAGE_REACTION_ADD  = 'MESSAGE_REACTION_ADD'
MESSAGE_REACTION_REMOVE  = 'MESSAGE_REACTION_REMOVE'
MESSAGE_REACTION_REMOVE_ALL  = 'MESSAGE_REACTION_REMOVE_ALL'
MESSAGE_REACTION_REMOVE_EMOJI  = 'MESSAGE_REACTION_REMOVE_EMOJI'
MESSAGE_UPDATE  = 'MESSAGE_UPDATE'
PRESENCE_UPDATE  = 'PRESENCE_UPDATE'
PRESENCES_REPLACE  = 'PRESENCES_REPLACE'
READY  = 'READY'
Not to be confused with 'ready'
RESUMED  = 'RESUMED'
STAGE_INSTANCE_CREATE  = 'STAGE_INSTANCE_CREATE'
STAGE_INSTANCE_DELETE  = 'STAGE_INSTANCE_DELETE'
STAGE_INSTANCE_UPDATE  = 'STAGE_INSTANCE_UPDATE'
THREAD_CREATE  = 'THREAD_CREATE'
THREAD_DELETE  = 'THREAD_DELETE'
THREAD_LIST_SYNC  = 'THREAD_LIST_SYNC'
THREAD_MEMBER_UPDATE  = 'THREAD_MEMBER_UPDATE'
THREAD_MEMBERS_UPDATE  = 'THREAD_MEMBERS_UPDATE'
THREAD_UPDATE  = 'THREAD_UPDATE'
TYPING_START  = 'TYPING_START'
USER_SETTINGS_UPDATE  = 'USER_SETTINGS_UPDATE'
USER_UPDATE  = 'USER_UPDATE'
VOICE_SERVER_UPDATE  = 'VOICE_SERVER_UPDATE'
VOICE_STATE_UPDATE  = 'VOICE_STATE_UPDATE'
WEBHOOKS_UPDATE  = 'WEBHOOKS_UPDATE'
$discord  : Discord
The Discord client instance.
$factory  : Factory
The Factory.
$http  : Http
The HTTP client.
__construct()  : mixed
Constructs an event.
__debugInfo()  : array<string|int, mixed>
handle()  : Generator
Transforms the given data, and updates the Discord instance if necessary.
cacheMember()  : mixed
Cache Member repository from Event data.
cacheUser()  : mixed
Cache User repository from Event data.

Constants

APPLICATION_COMMAND_PERMISSIONS_UPDATE

public mixed APPLICATION_COMMAND_PERMISSIONS_UPDATE = 'APPLICATION_COMMAND_PERMISSIONS_UPDATE'

AUTO_MODERATION_ACTION_EXECUTION

public mixed AUTO_MODERATION_ACTION_EXECUTION = 'AUTO_MODERATION_ACTION_EXECUTION'

AUTO_MODERATION_RULE_CREATE

public mixed AUTO_MODERATION_RULE_CREATE = 'AUTO_MODERATION_RULE_CREATE'

AUTO_MODERATION_RULE_DELETE

public mixed AUTO_MODERATION_RULE_DELETE = 'AUTO_MODERATION_RULE_DELETE'

AUTO_MODERATION_RULE_UPDATE

public mixed AUTO_MODERATION_RULE_UPDATE = 'AUTO_MODERATION_RULE_UPDATE'

CHANNEL_CREATE

public mixed CHANNEL_CREATE = 'CHANNEL_CREATE'

CHANNEL_DELETE

public mixed CHANNEL_DELETE = 'CHANNEL_DELETE'

CHANNEL_PINS_UPDATE

public mixed CHANNEL_PINS_UPDATE = 'CHANNEL_PINS_UPDATE'

CHANNEL_UPDATE

public mixed CHANNEL_UPDATE = 'CHANNEL_UPDATE'

GUILD_AUDIT_LOG_ENTRY_CREATE

public mixed GUILD_AUDIT_LOG_ENTRY_CREATE = 'GUILD_AUDIT_LOG_ENTRY_CREATE'

GUILD_BAN_ADD

public mixed GUILD_BAN_ADD = 'GUILD_BAN_ADD'

GUILD_BAN_REMOVE

public mixed GUILD_BAN_REMOVE = 'GUILD_BAN_REMOVE'

GUILD_CREATE

public mixed GUILD_CREATE = 'GUILD_CREATE'

GUILD_DELETE

public mixed GUILD_DELETE = 'GUILD_DELETE'

GUILD_EMOJIS_UPDATE

public mixed GUILD_EMOJIS_UPDATE = 'GUILD_EMOJIS_UPDATE'

GUILD_INTEGRATIONS_UPDATE

public mixed GUILD_INTEGRATIONS_UPDATE = 'GUILD_INTEGRATIONS_UPDATE'

GUILD_MEMBER_ADD

public mixed GUILD_MEMBER_ADD = 'GUILD_MEMBER_ADD'

GUILD_MEMBER_REMOVE

public mixed GUILD_MEMBER_REMOVE = 'GUILD_MEMBER_REMOVE'

GUILD_MEMBER_UPDATE

public mixed GUILD_MEMBER_UPDATE = 'GUILD_MEMBER_UPDATE'

GUILD_MEMBERS_CHUNK

public mixed GUILD_MEMBERS_CHUNK = 'GUILD_MEMBERS_CHUNK'

GUILD_ROLE_CREATE

public mixed GUILD_ROLE_CREATE = 'GUILD_ROLE_CREATE'

GUILD_ROLE_DELETE

public mixed GUILD_ROLE_DELETE = 'GUILD_ROLE_DELETE'

GUILD_ROLE_UPDATE

public mixed GUILD_ROLE_UPDATE = 'GUILD_ROLE_UPDATE'

GUILD_SCHEDULED_EVENT_CREATE

public mixed GUILD_SCHEDULED_EVENT_CREATE = 'GUILD_SCHEDULED_EVENT_CREATE'

GUILD_SCHEDULED_EVENT_DELETE

public mixed GUILD_SCHEDULED_EVENT_DELETE = 'GUILD_SCHEDULED_EVENT_DELETE'

GUILD_SCHEDULED_EVENT_UPDATE

public mixed GUILD_SCHEDULED_EVENT_UPDATE = 'GUILD_SCHEDULED_EVENT_UPDATE'

GUILD_SCHEDULED_EVENT_USER_ADD

public mixed GUILD_SCHEDULED_EVENT_USER_ADD = 'GUILD_SCHEDULED_EVENT_USER_ADD'

GUILD_SCHEDULED_EVENT_USER_REMOVE

public mixed GUILD_SCHEDULED_EVENT_USER_REMOVE = 'GUILD_SCHEDULED_EVENT_USER_REMOVE'

GUILD_STICKERS_UPDATE

public mixed GUILD_STICKERS_UPDATE = 'GUILD_STICKERS_UPDATE'

GUILD_UPDATE

public mixed GUILD_UPDATE = 'GUILD_UPDATE'

INTEGRATION_CREATE

public mixed INTEGRATION_CREATE = 'INTEGRATION_CREATE'

INTEGRATION_DELETE

public mixed INTEGRATION_DELETE = 'INTEGRATION_DELETE'

INTEGRATION_UPDATE

public mixed INTEGRATION_UPDATE = 'INTEGRATION_UPDATE'

INTERACTION_CREATE

public mixed INTERACTION_CREATE = 'INTERACTION_CREATE'

INVITE_CREATE

public mixed INVITE_CREATE = 'INVITE_CREATE'

INVITE_DELETE

public mixed INVITE_DELETE = 'INVITE_DELETE'

MESSAGE_CREATE

public mixed MESSAGE_CREATE = 'MESSAGE_CREATE'

MESSAGE_DELETE

public mixed MESSAGE_DELETE = 'MESSAGE_DELETE'

MESSAGE_DELETE_BULK

public mixed MESSAGE_DELETE_BULK = 'MESSAGE_DELETE_BULK'

MESSAGE_REACTION_ADD

public mixed MESSAGE_REACTION_ADD = 'MESSAGE_REACTION_ADD'

MESSAGE_REACTION_REMOVE

public mixed MESSAGE_REACTION_REMOVE = 'MESSAGE_REACTION_REMOVE'

MESSAGE_REACTION_REMOVE_ALL

public mixed MESSAGE_REACTION_REMOVE_ALL = 'MESSAGE_REACTION_REMOVE_ALL'

MESSAGE_REACTION_REMOVE_EMOJI

public mixed MESSAGE_REACTION_REMOVE_EMOJI = 'MESSAGE_REACTION_REMOVE_EMOJI'

MESSAGE_UPDATE

public mixed MESSAGE_UPDATE = 'MESSAGE_UPDATE'

PRESENCE_UPDATE

public mixed PRESENCE_UPDATE = 'PRESENCE_UPDATE'

PRESENCES_REPLACE

public mixed PRESENCES_REPLACE = 'PRESENCES_REPLACE'

READY

Not to be confused with 'ready'

public mixed READY = 'READY'

RESUMED

public mixed RESUMED = 'RESUMED'

STAGE_INSTANCE_CREATE

public mixed STAGE_INSTANCE_CREATE = 'STAGE_INSTANCE_CREATE'

STAGE_INSTANCE_DELETE

public mixed STAGE_INSTANCE_DELETE = 'STAGE_INSTANCE_DELETE'

STAGE_INSTANCE_UPDATE

public mixed STAGE_INSTANCE_UPDATE = 'STAGE_INSTANCE_UPDATE'

THREAD_CREATE

public mixed THREAD_CREATE = 'THREAD_CREATE'

THREAD_DELETE

public mixed THREAD_DELETE = 'THREAD_DELETE'

THREAD_LIST_SYNC

public mixed THREAD_LIST_SYNC = 'THREAD_LIST_SYNC'

THREAD_MEMBER_UPDATE

public mixed THREAD_MEMBER_UPDATE = 'THREAD_MEMBER_UPDATE'

THREAD_MEMBERS_UPDATE

public mixed THREAD_MEMBERS_UPDATE = 'THREAD_MEMBERS_UPDATE'

THREAD_UPDATE

public mixed THREAD_UPDATE = 'THREAD_UPDATE'

TYPING_START

public mixed TYPING_START = 'TYPING_START'

USER_SETTINGS_UPDATE

public mixed USER_SETTINGS_UPDATE = 'USER_SETTINGS_UPDATE'

USER_UPDATE

public mixed USER_UPDATE = 'USER_UPDATE'

VOICE_SERVER_UPDATE

public mixed VOICE_SERVER_UPDATE = 'VOICE_SERVER_UPDATE'

VOICE_STATE_UPDATE

public mixed VOICE_STATE_UPDATE = 'VOICE_STATE_UPDATE'

WEBHOOKS_UPDATE

public mixed WEBHOOKS_UPDATE = 'WEBHOOKS_UPDATE'

Properties

$discord

The Discord client instance.

protected Discord $discord

Client.

$http

The HTTP client.

protected Http $http

Client.

Methods

__construct()

Constructs an event.

public __construct(Discord $discord) : mixed
Parameters
$discord : Discord

The Discord client.

Return values
mixed

__debugInfo()

public __debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

handle()

Transforms the given data, and updates the Discord instance if necessary.

public abstract handle(object $data) : Generator
Parameters
$data : object

The data that was sent with the WebSocket.

Tags
since
10.0.0

Changed args from Deferred &$deferred, $data to $data, changed return from void to Generator.

since
4.0.0
Return values
Generator

cacheMember()

Cache Member repository from Event data.

protected cacheMember(MemberRepository $members, array<string|int, mixed> $memberdata) : mixed
Parameters
$members : MemberRepository

$guild->members

$memberdata : array<string|int, mixed>

(array) $data->member

Tags
since
10.0.0
Return values
mixed

cacheUser()

Cache User repository from Event data.

protected cacheUser(object $userdata) : mixed
Parameters
$userdata : object

$data->user or $data->member->user

Tags
since
7.0.0
Return values
mixed

Search results