DiscordPHP Documentation

Entry extends Part
in package

Represents an entry in the audit log.

Tags
since
5.1.0
link
https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
@property

?Options|null $options Additional info for certain action types.

@property

?string|null $reason Reason for the change (1-512 characters).

Table of Contents

Constants

APPLICATION_COMMAND_PERMISSION_UPDATE  = 121
Permissions were updated for a command.
AUTO_MODERATION_BLOCK_MESSAGE  = 143
Message was blocked by Auto Moderation.
AUTO_MODERATION_FLAG_TO_CHANNEL  = 144
Message was flagged by Auto Moderation.
AUTO_MODERATION_QUARANTINE_USER  = 146
Member was quarantined by Auto Moderation.
AUTO_MODERATION_RULE_CREATE  = 140
Auto Moderation rule was created.
AUTO_MODERATION_RULE_DELETE  = 142
Auto Moderation rule was deleted.
AUTO_MODERATION_RULE_UPDATE  = 141
Auto Moderation rule was updated.
AUTO_MODERATION_USER_COMMUNICATION_DISABLED  = 145
Member was timed out by Auto Moderation.
BOT_ADD  = 28
Bot user was added to server.
CHANNEL_CREATE  = 10
Channel was created.
CHANNEL_DELETE  = 12
Channel was deleted.
CHANNEL_OVERWRITE_CREATE  = 13
Permission overwrite was added to a channel.
CHANNEL_OVERWRITE_DELETE  = 15
Permission overwrite was deleted from a channel.
CHANNEL_OVERWRITE_UPDATE  = 14
Permission overwrite was updated for a channel.
CHANNEL_UPDATE  = 11
Channel settings were updated.
CREATOR_MONETIZATION_REQUEST_CREATED  = 150
Creator monetization request was created.
CREATOR_MONETIZATION_TERMS_ACCEPTED  = 151
Creator monetization terms were accepted.
EMOJI_CREATE  = 60
Emoji was created.
EMOJI_DELETE  = 62
Emoji was deleted.
EMOJI_UPDATE  = 61
Emoji name was updated.
GUILD_SCHEDULED_EVENT_CREATE  = 100
Event was created.
GUILD_SCHEDULED_EVENT_DELETE  = 102
Event was cancelled.
GUILD_SCHEDULED_EVENT_UPDATE  = 101
Event was updated.
GUILD_UPDATE  = 1
Server settings were updated.
HOME_SETTINGS_CREATE  = 190
Guild Server Guide was created.
HOME_SETTINGS_UPDATE  = 191
Guild Server Guide was updated.
INTEGRATION_CREATE  = 80
App was added to server.
INTEGRATION_DELETE  = 82
App was removed from server.
INTEGRATION_UPDATE  = 81
App was updated (as an example, its scopes were updated).
INVITE_CREATE  = 40
Server invite was created.
INVITE_DELETE  = 42
Server invite was deleted.
INVITE_UPDATE  = 41
Server invite was updated.
MEMBER_BAN_ADD  = 22
Member was banned from server.
MEMBER_BAN_REMOVE  = 23
Server ban was lifted for a member.
MEMBER_DISCONNECT  = 27
Member was disconnected from a voice channel.
MEMBER_KICK  = 20
Member was removed from server.
MEMBER_MOVE  = 26
Member was moved to a different voice channel.
MEMBER_PRUNE  = 21
Members were pruned from server.
MEMBER_ROLE_UPDATE  = 25
Member was added or removed from a role.
MEMBER_UPDATE  = 24
Member was updated in server.
MESSAGE_BULK_DELETE  = 73
Multiple messages were deleted.
MESSAGE_DELETE  = 72
Single message was deleted.
MESSAGE_PIN  = 74
Message was pinned to a channel.
MESSAGE_UNPIN  = 75
Message was unpinned from a channel.
ONBOARDING_CREATE  = 166
Guild Onboarding was created.
ONBOARDING_PROMPT_CREATE  = 163
Guild Onboarding Question was created.
ONBOARDING_PROMPT_DELETE  = 165
Guild Onboarding Question was deleted.
ONBOARDING_PROMPT_UPDATE  = 164
Guild Onboarding Question was updated.
ONBOARDING_UPDATE  = 167
Guild Onboarding was updated.
ROLE_CREATE  = 30
Role was created.
ROLE_DELETE  = 32
Role was deleted.
ROLE_UPDATE  = 31
Role was edited.
SOUNDBOARD_SOUND_CREATE  = 130
Soundboard sound was created.
SOUNDBOARD_SOUND_DELETE  = 132
Soundboard sound was deleted.
SOUNDBOARD_SOUND_UPDATE  = 131
Soundboard sound was updated.
STAGE_INSTANCE_CREATE  = 83
Stage instance was created (stage channel becomes live).
STAGE_INSTANCE_DELETE  = 85
Stage instance was deleted (stage channel no longer live).
STAGE_INSTANCE_UPDATE  = 84
Stage instance details were updated.
STICKER_CREATE  = 90
Sticker was created.
STICKER_DELETE  = 92
Sticker was deleted.
STICKER_UPDATE  = 91
Sticker details were updated.
THREAD_CREATE  = 110
Thread was created in a channel.
THREAD_DELETE  = 112
Thread was deleted.
THREAD_UPDATE  = 111
Thread was updated.
WEBHOOK_CREATE  = 50
Webhook was created.
WEBHOOK_DELETE  = 52
Webhook was deleted.
WEBHOOK_UPDATE  = 51
Webhook properties or channel were updated.

Properties

$action_type  : int
$changes  : CollectionInterface
$created  : bool
Is the part already created in the Discord servers?
$id  : string
$scriptData  : mixed
Custom script data.
$target_id  : string|null
$user  : User|null
$user_id  : string|null
$attributes  : array<string|int, mixed>
The parts attributes.
$discord  : Discord
The Discord client.
$factory  : Factory
The factory.
$fillable  : array<string|int, mixed>
The parts fillable attributes.
$hidden  : array<string|int, mixed>
Attributes that are hidden from debug info.
$http  : Http
The HTTP client.
$repositories  : array<string|int, mixed>
An array of repositories that can exist in a part.
$repositories_cache  : array<string|int, mixed>
An array of repositories.
$visible  : array<string|int, mixed>
Attributes which are visible from debug info.

Methods

__construct()  : mixed
Create a new part instance.
__debugInfo()  : array<string|int, mixed>
__get()  : mixed
Handles dynamic get calls onto the part.
__serialize()  : array<string|int, mixed>
__set()  : void
Handles dynamic set calls onto the part.
__toString()  : string
Converts the part to a string.
__unserialize()  : void
fetch()  : PromiseInterface<string|int, static>
Fetches any missing information about the part from Discord's servers.
fill()  : void
Fills the parts attributes from an array.
getConstants()  : array<string|int, mixed>
Returns an array of constant names and their values.
getCreatableAttributes()  : array<string|int, mixed>
Returns the attributes needed to create.
getDiscord()  : Discord
Get the Discord instance that owns this Part.
getPublicAttributes()  : array<string|int, mixed>
Returns an array of public attributes.
getRawAttributes()  : array<string|int, mixed>
Returns an array of raw attributes.
getRepositoryAttributes()  : array<string|int, mixed>
Gets the attributes to pass to repositories.
getUpdatableAttributes()  : array<string|int, mixed>
Returns the updatable attributes.
isPartial()  : bool
Whether the part is considered partial i.e. missing information which can be fetched from Discord.
jsonSerialize()  : array<string|int, mixed>
Provides data when the part is encoded into JSON. Used for JsonSerializable.
offsetExists()  : bool
Checks if an attribute exists via key. Used for ArrayAccess.
offsetGet()  : mixed
Gets an attribute via key. Used for ArrayAccess.
offsetSet()  : void
Sets an attribute via key. Used for ArrayAccess.
offsetUnset()  : void
Unsets an attribute via key. Used for ArrayAccess.
serialize()  : string|null
Serializes the data. Used for Serializable.
unserialize()  : void
Unserializes some data and stores it. Used for Serializable.
afterConstruct()  : void
Called after the part has been constructed.
getChangesAttribute()  : ExCollectionInterface
Returns a collection of changes.
getOptionsAttribute()  : Options
Returns the options of the entry.
getUserAttribute()  : User|null
Returns the user who made the changes.
makeOptionalAttributes()  : array<string|int, mixed>
Return key-value attributes if it has been filled.
checkForGetMutator()  : string|false
Checks if there is a get mutator present.
checkForSetMutator()  : string|false
Checks if there is a set mutator present.
getAttribute()  : mixed
Gets an attribute on the part.
setAttribute()  : void
Sets an attribute on the part.
studly()  : string
Converts a string to studlyCase.

Constants

APPLICATION_COMMAND_PERMISSION_UPDATE

Permissions were updated for a command.

public mixed APPLICATION_COMMAND_PERMISSION_UPDATE = 121

AUTO_MODERATION_BLOCK_MESSAGE

Message was blocked by Auto Moderation.

public mixed AUTO_MODERATION_BLOCK_MESSAGE = 143

AUTO_MODERATION_FLAG_TO_CHANNEL

Message was flagged by Auto Moderation.

public mixed AUTO_MODERATION_FLAG_TO_CHANNEL = 144

AUTO_MODERATION_QUARANTINE_USER

Member was quarantined by Auto Moderation.

public mixed AUTO_MODERATION_QUARANTINE_USER = 146

AUTO_MODERATION_RULE_CREATE

Auto Moderation rule was created.

public mixed AUTO_MODERATION_RULE_CREATE = 140

AUTO_MODERATION_RULE_DELETE

Auto Moderation rule was deleted.

public mixed AUTO_MODERATION_RULE_DELETE = 142

AUTO_MODERATION_RULE_UPDATE

Auto Moderation rule was updated.

public mixed AUTO_MODERATION_RULE_UPDATE = 141

AUTO_MODERATION_USER_COMMUNICATION_DISABLED

Member was timed out by Auto Moderation.

public mixed AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145

BOT_ADD

Bot user was added to server.

public mixed BOT_ADD = 28

CHANNEL_CREATE

Channel was created.

public mixed CHANNEL_CREATE = 10

CHANNEL_DELETE

Channel was deleted.

public mixed CHANNEL_DELETE = 12

CHANNEL_OVERWRITE_CREATE

Permission overwrite was added to a channel.

public mixed CHANNEL_OVERWRITE_CREATE = 13

CHANNEL_OVERWRITE_DELETE

Permission overwrite was deleted from a channel.

public mixed CHANNEL_OVERWRITE_DELETE = 15

CHANNEL_OVERWRITE_UPDATE

Permission overwrite was updated for a channel.

public mixed CHANNEL_OVERWRITE_UPDATE = 14

CHANNEL_UPDATE

Channel settings were updated.

public mixed CHANNEL_UPDATE = 11

CREATOR_MONETIZATION_REQUEST_CREATED

Creator monetization request was created.

public mixed CREATOR_MONETIZATION_REQUEST_CREATED = 150

CREATOR_MONETIZATION_TERMS_ACCEPTED

Creator monetization terms were accepted.

public mixed CREATOR_MONETIZATION_TERMS_ACCEPTED = 151

EMOJI_CREATE

Emoji was created.

public mixed EMOJI_CREATE = 60

EMOJI_DELETE

Emoji was deleted.

public mixed EMOJI_DELETE = 62

EMOJI_UPDATE

Emoji name was updated.

public mixed EMOJI_UPDATE = 61

GUILD_SCHEDULED_EVENT_CREATE

Event was created.

public mixed GUILD_SCHEDULED_EVENT_CREATE = 100

GUILD_SCHEDULED_EVENT_DELETE

Event was cancelled.

public mixed GUILD_SCHEDULED_EVENT_DELETE = 102

GUILD_SCHEDULED_EVENT_UPDATE

Event was updated.

public mixed GUILD_SCHEDULED_EVENT_UPDATE = 101

GUILD_UPDATE

Server settings were updated.

public mixed GUILD_UPDATE = 1

HOME_SETTINGS_CREATE

Guild Server Guide was created.

public mixed HOME_SETTINGS_CREATE = 190

HOME_SETTINGS_UPDATE

Guild Server Guide was updated.

public mixed HOME_SETTINGS_UPDATE = 191

INTEGRATION_CREATE

App was added to server.

public mixed INTEGRATION_CREATE = 80

INTEGRATION_DELETE

App was removed from server.

public mixed INTEGRATION_DELETE = 82

INTEGRATION_UPDATE

App was updated (as an example, its scopes were updated).

public mixed INTEGRATION_UPDATE = 81

INVITE_CREATE

Server invite was created.

public mixed INVITE_CREATE = 40

INVITE_DELETE

Server invite was deleted.

public mixed INVITE_DELETE = 42

INVITE_UPDATE

Server invite was updated.

public mixed INVITE_UPDATE = 41

MEMBER_BAN_ADD

Member was banned from server.

public mixed MEMBER_BAN_ADD = 22

MEMBER_BAN_REMOVE

Server ban was lifted for a member.

public mixed MEMBER_BAN_REMOVE = 23

MEMBER_DISCONNECT

Member was disconnected from a voice channel.

public mixed MEMBER_DISCONNECT = 27

MEMBER_KICK

Member was removed from server.

public mixed MEMBER_KICK = 20

MEMBER_MOVE

Member was moved to a different voice channel.

public mixed MEMBER_MOVE = 26

MEMBER_PRUNE

Members were pruned from server.

public mixed MEMBER_PRUNE = 21

MEMBER_ROLE_UPDATE

Member was added or removed from a role.

public mixed MEMBER_ROLE_UPDATE = 25

MEMBER_UPDATE

Member was updated in server.

public mixed MEMBER_UPDATE = 24

MESSAGE_BULK_DELETE

Multiple messages were deleted.

public mixed MESSAGE_BULK_DELETE = 73

MESSAGE_DELETE

Single message was deleted.

public mixed MESSAGE_DELETE = 72

MESSAGE_PIN

Message was pinned to a channel.

public mixed MESSAGE_PIN = 74

MESSAGE_UNPIN

Message was unpinned from a channel.

public mixed MESSAGE_UNPIN = 75

ONBOARDING_CREATE

Guild Onboarding was created.

public mixed ONBOARDING_CREATE = 166

ONBOARDING_PROMPT_CREATE

Guild Onboarding Question was created.

public mixed ONBOARDING_PROMPT_CREATE = 163

ONBOARDING_PROMPT_DELETE

Guild Onboarding Question was deleted.

public mixed ONBOARDING_PROMPT_DELETE = 165

ONBOARDING_PROMPT_UPDATE

Guild Onboarding Question was updated.

public mixed ONBOARDING_PROMPT_UPDATE = 164

ONBOARDING_UPDATE

Guild Onboarding was updated.

public mixed ONBOARDING_UPDATE = 167

ROLE_CREATE

Role was created.

public mixed ROLE_CREATE = 30

ROLE_DELETE

Role was deleted.

public mixed ROLE_DELETE = 32

ROLE_UPDATE

Role was edited.

public mixed ROLE_UPDATE = 31

SOUNDBOARD_SOUND_CREATE

Soundboard sound was created.

public mixed SOUNDBOARD_SOUND_CREATE = 130

SOUNDBOARD_SOUND_DELETE

Soundboard sound was deleted.

public mixed SOUNDBOARD_SOUND_DELETE = 132

SOUNDBOARD_SOUND_UPDATE

Soundboard sound was updated.

public mixed SOUNDBOARD_SOUND_UPDATE = 131

STAGE_INSTANCE_CREATE

Stage instance was created (stage channel becomes live).

public mixed STAGE_INSTANCE_CREATE = 83

STAGE_INSTANCE_DELETE

Stage instance was deleted (stage channel no longer live).

public mixed STAGE_INSTANCE_DELETE = 85

STAGE_INSTANCE_UPDATE

Stage instance details were updated.

public mixed STAGE_INSTANCE_UPDATE = 84

STICKER_CREATE

Sticker was created.

public mixed STICKER_CREATE = 90

STICKER_DELETE

Sticker was deleted.

public mixed STICKER_DELETE = 92

STICKER_UPDATE

Sticker details were updated.

public mixed STICKER_UPDATE = 91

THREAD_CREATE

Thread was created in a channel.

public mixed THREAD_CREATE = 110

THREAD_DELETE

Thread was deleted.

public mixed THREAD_DELETE = 112

THREAD_UPDATE

Thread was updated.

public mixed THREAD_UPDATE = 111

WEBHOOK_CREATE

Webhook was created.

public mixed WEBHOOK_CREATE = 50

WEBHOOK_DELETE

Webhook was deleted.

public mixed WEBHOOK_DELETE = 52

WEBHOOK_UPDATE

Webhook properties or channel were updated.

public mixed WEBHOOK_UPDATE = 51

Properties

$action_type

public int $action_type

Type of action that occurred.

$changes

public CollectionInterface $changes

Changes made to the target_id.

$created

Is the part already created in the Discord servers?

public bool $created = false

Whether the part has been created.

$id

public string $id

ID of the entry.

$scriptData

Custom script data.

Relying on this variable with dynamic caching is discouraged.

public mixed $scriptData

Used for storing custom information, used by end products.

$target_id

public string|null $target_id

ID of the affected entity (webhook, user, role, etc.).

$user_id

public string|null $user_id

User or app that made the changes.

$attributes

The parts attributes.

protected array<string|int, mixed> $attributes = []

The parts attributes and content.

$discord

The Discord client.

protected Discord $discord

Client.

$fillable

The parts fillable attributes.

protected array<string|int, mixed> $fillable = ['target_id', 'changes', 'user_id', 'id', 'action_type', 'options', 'reason']

The array of attributes that can be mass-assigned.

Tags
inheritDoc

$hidden

Attributes that are hidden from debug info.

protected array<string|int, mixed> $hidden = []

Attributes that are hidden from public.

$http

The HTTP client.

protected Http $http

Client.

$repositories

An array of repositories that can exist in a part.

protected array<string|int, mixed> $repositories = []

Repositories.

$repositories_cache

An array of repositories.

protected array<string|int, mixed> $repositories_cache = []

$visible

Attributes which are visible from debug info.

protected array<string|int, mixed> $visible = []

Methods

__construct()

Create a new part instance.

public __construct(Discord $discord[, array<string|int, mixed> $attributes = [] ][, bool $created = false ]) : mixed
Parameters
$discord : Discord

The Discord client.

$attributes : array<string|int, mixed> = []

An array of attributes to build the part.

$created : bool = false

Whether the part has already been created.

__debugInfo()

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

__get()

Handles dynamic get calls onto the part.

public __get(string $key) : mixed
Parameters
$key : string

The attributes key.

Tags
throws
Exception
see
Part::getAttribute()

This function forwards onto getAttribute.

Return values
mixed

The value of the attribute.

__serialize()

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

__set()

Handles dynamic set calls onto the part.

public __set(string $key, mixed $value) : void
Parameters
$key : string

The attributes key.

$value : mixed

The attributes value.

Tags
see
self::setAttribute()

This function forwards onto setAttribute.

__toString()

Converts the part to a string.

public __toString() : string
Tags
throws
Exception
see
Part::getPublicAttributes()

This function encodes getPublicAttributes into JSON.

Return values
string

A JSON string of attributes.

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

fetch()

Fetches any missing information about the part from Discord's servers.

public fetch() : PromiseInterface<string|int, static>
Tags
throws
RuntimeException

The part is not fetchable.

Return values
PromiseInterface<string|int, static>

fill()

Fills the parts attributes from an array.

public fill(array<string|int, mixed> $attributes) : void
Parameters
$attributes : array<string|int, mixed>

An array of attributes to build the part.

Tags
see
self::setAttribute()

getConstants()

Returns an array of constant names and their values.

public getConstants() : array<string|int, mixed>
Tags
since
10.19.0
Return values
array<string|int, mixed>

An associative array where keys are constant names and values are their values.

getCreatableAttributes()

Returns the attributes needed to create.

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

getPublicAttributes()

Returns an array of public attributes.

public getPublicAttributes() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

An array of public attributes.

getRawAttributes()

Returns an array of raw attributes.

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

Raw attributes.

getRepositoryAttributes()

Gets the attributes to pass to repositories.

public getRepositoryAttributes() : array<string|int, mixed>

Note: The order matters for repository tree (top to bottom).

Return values
array<string|int, mixed>

Attributes.

getUpdatableAttributes()

Returns the updatable attributes.

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

isPartial()

Whether the part is considered partial i.e. missing information which can be fetched from Discord.

public isPartial() : bool
Return values
bool

jsonSerialize()

Provides data when the part is encoded into JSON. Used for JsonSerializable.

public jsonSerialize() : array<string|int, mixed>
Tags
throws
Exception
see
Part::getPublicAttributes()

This function forwards onto getPublicAttributes.

Return values
array<string|int, mixed>

An array of public attributes.

offsetExists()

Checks if an attribute exists via key. Used for ArrayAccess.

public offsetExists(string $key) : bool
Parameters
$key : string

The attribute key.

Return values
bool

Whether the offset exists.

offsetGet()

Gets an attribute via key. Used for ArrayAccess.

public offsetGet(string $key) : mixed
Parameters
$key : string

The attribute key.

Tags
throws
Exception
see
Part::getAttribute()

This function forwards onto getAttribute.

Attributes
#[ReturnTypeWillChange]

offsetSet()

Sets an attribute via key. Used for ArrayAccess.

public offsetSet(string $key, mixed $value) : void
Parameters
$key : string

The attribute key.

$value : mixed

The attribute value.

Tags
see
Part::setAttribute()

This function forwards onto setAttribute.

offsetUnset()

Unsets an attribute via key. Used for ArrayAccess.

public offsetUnset(string $key) : void
Parameters
$key : string

The attribute key.

serialize()

Serializes the data. Used for Serializable.

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

A string of serialized data.

unserialize()

Unserializes some data and stores it. Used for Serializable.

public unserialize(string $data) : void
Parameters
$data : string

Some serialized data.

Tags
see
Part::setAttribute()

The unserialized data is stored with setAttribute.

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void

getOptionsAttribute()

Returns the options of the entry.

protected getOptionsAttribute() : Options
Return values
Options

getUserAttribute()

Returns the user who made the changes.

protected getUserAttribute() : User|null
Return values
User|null

makeOptionalAttributes()

Return key-value attributes if it has been filled.

protected makeOptionalAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>

To be used with fields marked "optional?" from the API.

Parameters
$attributes : array<string|int, mixed>

Names of optional attribute

Return values
array<string|int, mixed>

checkForGetMutator()

Checks if there is a get mutator present.

private checkForGetMutator(string $key) : string|false
Parameters
$key : string

The attribute name to check.

Tags
since
10.0.0

Replaces checkForMutator($key, 'get')

Return values
string|false

Either a string if it is a method or false.

checkForSetMutator()

Checks if there is a set mutator present.

private checkForSetMutator(string $key) : string|false
Parameters
$key : string

The attribute name to check.

Tags
since
10.0.0

Replaces checkForMutator($key, 'set')

Return values
string|false

Either a string if it is a method or false.

getAttribute()

Gets an attribute on the part.

private getAttribute(string $key) : mixed
Parameters
$key : string

The key to the attribute.

Tags
throws
Exception
Return values
mixed

Either the attribute if it exists or void.

setAttribute()

Sets an attribute on the part.

private setAttribute(string $key, mixed $value) : void
Parameters
$key : string

The key to the attribute.

$value : mixed

The value of the attribute.

studly()

Converts a string to studlyCase.

private static studly(string $string) : string

This is a port of updated Laravel's implementation, a non-regex with static cache. The Discord\studly() is kept due to unintended bug and we do not want to introduce BC by replacing it. This method is private static as we may move it outside this class in future.

Parameters
$string : string

The string to convert.

Tags
since
10.0.0
Return values
string

        
On this page

Search results