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

Table of Contents

APPLICATION_COMMAND_PERMISSION_UPDATE  = 121
AUTO_MODERATION_BLOCK_MESSAGE  = 143
AUTO_MODERATION_FLAG_TO_CHANNEL  = 144
AUTO_MODERATION_RULE_CREATE  = 140
AUTO_MODERATION_RULE_DELETE  = 142
AUTO_MODERATION_RULE_UPDATE  = 141
AUTO_MODERATION_USER_COMMUNICATION_DISABLED  = 145
BOT_ADD  = 28
CHANNEL_CREATE  = 10
CHANNEL_DELETE  = 12
CHANNEL_OVERWRITE_CREATE  = 13
CHANNEL_OVERWRITE_DELETE  = 15
CHANNEL_OVERWRITE_UPDATE  = 14
CHANNEL_UPDATE  = 11
EMOJI_CREATE  = 60
EMOJI_DELETE  = 62
EMOJI_UPDATE  = 61
GUILD_SCHEDULED_EVENT_CREATE  = 100
GUILD_SCHEDULED_EVENT_DELETE  = 102
GUILD_SCHEDULED_EVENT_UPDATE  = 101
GUILD_UPDATE  = 1
INTEGRATION_CREATE  = 80
INTEGRATION_DELETE  = 82
INTEGRATION_UPDATE  = 81
INVITE_CREATE  = 40
INVITE_DELETE  = 42
INVITE_UPDATE  = 41
MEMBER_BAN_ADD  = 22
MEMBER_BAN_REMOVE  = 23
MEMBER_DISCONNECT  = 27
MEMBER_KICK  = 20
MEMBER_MOVE  = 26
MEMBER_PRUNE  = 21
MEMBER_ROLE_UPDATE  = 25
MEMBER_UPDATE  = 24
MESSAGE_BULK_DELETE  = 63
MESSAGE_DELETE  = 72
MESSAGE_PIN  = 74
MESSAGE_UNPIN  = 75
ROLE_CREATE  = 30
ROLE_DELETE  = 32
ROLE_UPDATE  = 31
STAGE_INSTANCE_CREATE  = 83
STAGE_INSTANCE_DELETE  = 85
STAGE_INSTANCE_UPDATE  = 84
STICKER_CREATE  = 90
STICKER_DELETE  = 92
STICKER_UPDATE  = 91
THREAD_CREATE  = 110
THREAD_DELETE  = 112
THREAD_UPDATE  = 111
WEBHOOK_CREATE  = 50
WEBHOOK_DELETE  = 52
WEBHOOK_UPDATE  = 51
$action_type  : int
$changes  : Collection
$created  : bool
Is the part already created in the Discord servers?
$id  : string
$options  : Options|null
$reason  : string|null
$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.
__construct()  : mixed
Create a new part instance.
__debugInfo()  : array<string|int, mixed>
Handles debug calls from var_dump and similar functions.
__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()  : ExtendedPromiseInterface<string|int, self>
Fetches any missing information about the part from Discord's servers.
fill()  : void
Fills the parts attributes from an array.
getCreatableAttributes()  : array<string|int, mixed>
Returns the attributes needed to create.
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()  : Collection
Returns a collection of changes.
getOptionsAttribute()  : Options
Returns the options of the entry.
getUserAttribute()  : User|null
Returns the user who made the changes.
checkForMutator()  : string|false
Checks if there is a 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

public mixed APPLICATION_COMMAND_PERMISSION_UPDATE = 121

AUTO_MODERATION_BLOCK_MESSAGE

public mixed AUTO_MODERATION_BLOCK_MESSAGE = 143

AUTO_MODERATION_FLAG_TO_CHANNEL

public mixed AUTO_MODERATION_FLAG_TO_CHANNEL = 144

AUTO_MODERATION_RULE_CREATE

public mixed AUTO_MODERATION_RULE_CREATE = 140

AUTO_MODERATION_RULE_DELETE

public mixed AUTO_MODERATION_RULE_DELETE = 142

AUTO_MODERATION_RULE_UPDATE

public mixed AUTO_MODERATION_RULE_UPDATE = 141

AUTO_MODERATION_USER_COMMUNICATION_DISABLED

public mixed AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145

BOT_ADD

public mixed BOT_ADD = 28

CHANNEL_CREATE

public mixed CHANNEL_CREATE = 10

CHANNEL_DELETE

public mixed CHANNEL_DELETE = 12

CHANNEL_OVERWRITE_CREATE

public mixed CHANNEL_OVERWRITE_CREATE = 13

CHANNEL_OVERWRITE_DELETE

public mixed CHANNEL_OVERWRITE_DELETE = 15

CHANNEL_OVERWRITE_UPDATE

public mixed CHANNEL_OVERWRITE_UPDATE = 14

CHANNEL_UPDATE

public mixed CHANNEL_UPDATE = 11

EMOJI_CREATE

public mixed EMOJI_CREATE = 60

EMOJI_DELETE

public mixed EMOJI_DELETE = 62

EMOJI_UPDATE

public mixed EMOJI_UPDATE = 61

GUILD_SCHEDULED_EVENT_CREATE

public mixed GUILD_SCHEDULED_EVENT_CREATE = 100

GUILD_SCHEDULED_EVENT_DELETE

public mixed GUILD_SCHEDULED_EVENT_DELETE = 102

GUILD_SCHEDULED_EVENT_UPDATE

public mixed GUILD_SCHEDULED_EVENT_UPDATE = 101

GUILD_UPDATE

public mixed GUILD_UPDATE = 1

INTEGRATION_CREATE

public mixed INTEGRATION_CREATE = 80

INTEGRATION_DELETE

public mixed INTEGRATION_DELETE = 82

INTEGRATION_UPDATE

public mixed INTEGRATION_UPDATE = 81

INVITE_CREATE

public mixed INVITE_CREATE = 40

INVITE_DELETE

public mixed INVITE_DELETE = 42

INVITE_UPDATE

public mixed INVITE_UPDATE = 41

MEMBER_BAN_ADD

public mixed MEMBER_BAN_ADD = 22

MEMBER_BAN_REMOVE

public mixed MEMBER_BAN_REMOVE = 23

MEMBER_DISCONNECT

public mixed MEMBER_DISCONNECT = 27

MEMBER_KICK

public mixed MEMBER_KICK = 20

MEMBER_MOVE

public mixed MEMBER_MOVE = 26

MEMBER_PRUNE

public mixed MEMBER_PRUNE = 21

MEMBER_ROLE_UPDATE

public mixed MEMBER_ROLE_UPDATE = 25

MEMBER_UPDATE

public mixed MEMBER_UPDATE = 24

MESSAGE_BULK_DELETE

public mixed MESSAGE_BULK_DELETE = 63

MESSAGE_DELETE

public mixed MESSAGE_DELETE = 72

MESSAGE_PIN

public mixed MESSAGE_PIN = 74

MESSAGE_UNPIN

public mixed MESSAGE_UNPIN = 75

ROLE_CREATE

public mixed ROLE_CREATE = 30

ROLE_DELETE

public mixed ROLE_DELETE = 32

ROLE_UPDATE

public mixed ROLE_UPDATE = 31

STAGE_INSTANCE_CREATE

public mixed STAGE_INSTANCE_CREATE = 83

STAGE_INSTANCE_DELETE

public mixed STAGE_INSTANCE_DELETE = 85

STAGE_INSTANCE_UPDATE

public mixed STAGE_INSTANCE_UPDATE = 84

STICKER_CREATE

public mixed STICKER_CREATE = 90

STICKER_DELETE

public mixed STICKER_DELETE = 92

STICKER_UPDATE

public mixed STICKER_UPDATE = 91

THREAD_CREATE

public mixed THREAD_CREATE = 110

THREAD_DELETE

public mixed THREAD_DELETE = 112

THREAD_UPDATE

public mixed THREAD_UPDATE = 111

WEBHOOK_CREATE

public mixed WEBHOOK_CREATE = 50

WEBHOOK_DELETE

public mixed WEBHOOK_DELETE = 52

WEBHOOK_UPDATE

public mixed WEBHOOK_UPDATE = 51

Properties

$action_type

public int $action_type

Type of action that occurred.

$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.

$options

public Options|null $options

Additional info for certain action types.

$reason

public string|null $reason

The reason for the change (0-512 characters).

$scriptData

Custom script data.

public mixed $scriptData

Used for storing custom information, used by end products.

Tags
deprecated
10.0.0

Relying on this variable with dynamic caching is discouraged.

$target_id

public string|null $target_id

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

$user_id

public string|null $user_id

The user who 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.

$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.

Return values
mixed

__debugInfo()

Handles debug calls from var_dump and similar functions.

public __debugInfo() : 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.

__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.

Return values
void

__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>
Return values
void

fetch()

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

public fetch() : ExtendedPromiseInterface<string|int, self>
Tags
throws
RuntimeException

The part is not fetchable.

Return values
ExtendedPromiseInterface<string|int, self>

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.

Return values
void

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.

Return values
mixed

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.

Return values
void

offsetUnset()

Unsets an attribute via key. Used for ArrayAccess.

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

The attribute key.

Return values
void

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.

Return values
void

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void
Return values
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

checkForMutator()

Checks if there is a mutator present.

private checkForMutator(string $key, string $type) : string|false
Parameters
$key : string

The attribute name to check.

$type : string

Either get or set.

Return values
string|false

Either a string if it is callable 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.

Return values
void

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

Search results