DiscordPHP Documentation

GameDirectMessage extends Message
in package

A direct message sent while at least one of its users has an active Social SDK session.

Delivered by the GAME_DIRECT_MESSAGE_* webhook events: a message with the DM channel and its recipients attached. Between two provisional accounts it is an "SDK DM message", which exists only in-game and carries a subset of a message's fields.

The bot is not in the DM, so the methods it inherits that act through the channel, such as reply(), edit(), delete() and react(), reject with a \BadMethodCallException rather than send a request Discord would refuse. Moderate it with GameDirectMessage::updateModerationMetadata().

Tags
since
10.59.0
link
https://docs.discord.com/developers/events/webhook-events#message-object
https://docs.discord.com/developers/events/webhook-events#sdk-dm-message-object

Table of Contents

Constants

CHANNEL_FOLLOW_ADD  : mixed = self::TYPE_CHANNEL_FOLLOW_ADD
CHANNEL_PINNED_MESSAGE  : mixed = self::TYPE_CHANNEL_PINNED_MESSAGE
FLAG_CROSSPOSTED  : mixed = 1 << 0
This message has been published to subscribed channels (via Channel Following).
FLAG_EPHEMERAL  : mixed = 1 << 6
This message is only visible to the user who invoked the Interaction.
FLAG_FAILED_TO_MENTION_SOME_ROLES_IN_THREAD  : mixed = 1 << 8
This message failed to mention some roles and add their members to the thread.
FLAG_HAS_SNAPSHOT  : mixed = 1 << 14
This message has a snapshot (via Message Forwarding).
FLAG_HAS_THREAD  : mixed = 1 << 5
This message has an associated thread, with the same id as the message.
FLAG_IS_COMPONENTS_V2  : mixed = 1 << 15
Allows you to create fully component-driven messages. Once a message has been sent with this flag, it can't be removed from that message.
FLAG_IS_CROSSPOST  : mixed = 1 << 1
This message originated from a message in another channel (via Channel Following).
FLAG_IS_V2_COMPONENTS  : mixed = 1 << 15
FLAG_IS_VOICE_MESSAGE  : mixed = 1 << 13
This message is a voice message.
FLAG_LOADING  : mixed = 1 << 7
This message is an Interaction Response and the bot is "thinking".
FLAG_SOURCE_MESSAGE_DELETED  : mixed = 1 << 3
The source message for this crosspost has been deleted (via Channel Following).
FLAG_SUPPRESS_EMBED  : mixed = 1 << 2
FLAG_SUPPRESS_EMBEDS  : mixed = 1 << 2
Do not include any embeds when serializing this message.
FLAG_SUPPRESS_NOTIFICATIONS  : mixed = 1 << 12
This message will not trigger push and desktop notifications.
FLAG_URGENT  : mixed = 1 << 4
This message came from the urgent message system.
GUILD_DISCOVERY_DISQUALIFIED  : mixed = self::TYPE_GUILD_DISCOVERY_DISQUALIFIED
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING  : mixed = self::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_W...
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING  : mixed = self::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL...
GUILD_DISCOVERY_REQUALIFIED  : mixed = self::TYPE_GUILD_DISCOVERY_REQUALIFIED
GUILD_MEMBER_JOIN  : mixed = self::TYPE_USER_JOIN
REACT_DELETE_ALL  : mixed = 0
REACT_DELETE_EMOJI  : mixed = 3
REACT_DELETE_ID  : mixed = 2
REACT_DELETE_ME  : mixed = 1
REFERENCE_DEFAULT  : mixed = 0
A standard reference used by replies.
REFERENCE_FORWARD  : mixed = 1
Reference used to point to a message at a point in time.
TYPE_APPLICATION_COMMAND  : mixed = self::TYPE_CHAT_INPUT_COMMAND
TYPE_AUTO_MODERATION_ACTION  : mixed = 24
TYPE_CALL  : mixed = 3
TYPE_CHANNEL_FOLLOW_ADD  : mixed = 12
TYPE_CHANNEL_ICON_CHANGE  : mixed = 5
TYPE_CHANNEL_NAME_CHANGE  : mixed = 4
TYPE_CHANNEL_PINNED_MESSAGE  : mixed = 6
TYPE_CHAT_INPUT_COMMAND  : mixed = 20
TYPE_CONTEXT_MENU_COMMAND  : mixed = 23
TYPE_DEFAULT  : mixed = 0
TYPE_EMOJI_ADDED  : mixed = 63
TYPE_GUILD_APPLICATION_PREMIUM_SUBSCRIPTION  : mixed = 32
TYPE_GUILD_BOOST  : mixed = 8
TYPE_GUILD_BOOST_TIER_1  : mixed = 9
TYPE_GUILD_BOOST_TIER_2  : mixed = 10
TYPE_GUILD_BOOST_TIER_3  : mixed = 11
TYPE_GUILD_DISCOVERY_DISQUALIFIED  : mixed = 14
TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING  : mixed = 17
TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING  : mixed = 16
TYPE_GUILD_DISCOVERY_REQUALIFIED  : mixed = 15
TYPE_GUILD_INCIDENT_ALERT_MODE_DISABLED  : mixed = 37
TYPE_GUILD_INCIDENT_ALERT_MODE_ENABLED  : mixed = 36
TYPE_GUILD_INCIDENT_REPORT_FALSE_ALARM  : mixed = 39
TYPE_GUILD_INCIDENT_REPORT_RAID  : mixed = 38
TYPE_GUILD_INVITE_REMINDER  : mixed = 22
TYPE_INTERACTION_PREMIUM_UPSELL  : mixed = 26
TYPE_NORMAL  : mixed = self::TYPE_DEFAULT
TYPE_POLL_RESULT  : mixed = 46
TYPE_PREMIUM_GROUP_INVITE  : mixed = 64
TYPE_PURCHASE_NOTIFICATION  : mixed = 44
TYPE_RECIPIENT_ADD  : mixed = 1
TYPE_RECIPIENT_REMOVE  : mixed = 2
TYPE_REPLY  : mixed = 19
TYPE_ROLE_SUBSCRIPTION_PURCHASE  : mixed = 25
TYPE_STAGE_END  : mixed = 28
TYPE_STAGE_SPEAKER  : mixed = 29
TYPE_STAGE_START  : mixed = 27
TYPE_STAGE_TOPIC  : mixed = 31
TYPE_THREAD_CREATED  : mixed = 18
TYPE_THREAD_STARTER_MESSAGE  : mixed = 21
TYPE_USER_ADDED  : mixed = self::TYPE_RECIPIENT_ADD
TYPE_USER_JOIN  : mixed = 7
TYPE_USER_REMOVED  : mixed = self::TYPE_RECIPIENT_REMOVE
USER_PREMIUM_GUILD_SUBSCRIPTION  : mixed = self::TYPE_GUILD_BOOST
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1  : mixed = self::TYPE_GUILD_BOOST_TIER_1
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2  : mixed = self::TYPE_GUILD_BOOST_TIER_2
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3  : mixed = self::TYPE_GUILD_BOOST_TIER_3
GAME_FILLABLE  : mixed = ['channel', 'recipient_id', 'lobby_id', 'modera...
The fields Discord adds to a message for these events.

Properties

$activity  : Activity|null
$application  : Application|null
$application_id  : string|null
$attachments  : ExCollectionInterface<string|int, Attachment>|array<string|int, Attachment>
$author  : User|null
$call  : MessageCall|null
$channel  : Channel
$channel_id  : string
$channel_type  : int|null
$components  : ExCollectionInterface<string|int, Component>|array<string|int, Component>
$content  : string
$created  : bool
Is the part already created in the Discord servers?
$crossposted  : bool
$edited_timestamp  : ?Carbon|null
$embeds  : ExCollectionInterface<string|int, Embed>|array<string|int, Embed>
$ephemeral  : bool
$failed_to_mention_some_roles_in_thread  : bool
$flags  : int|null
$guild  : Guild|null
$guild_id  : string|null
$has_thread  : bool
$id  : string
$interaction  : MessageInteraction|null
$interaction_metadata  : MessageInteractionMetadata|null
$is_crosspost  : bool
$link  : string|null
$loading  : bool
$lobby_id  : string|null
$member  : Member|null
$mention_channels  : ExCollectionInterface<string|int, Channel>|array<string|int, Channel>
$mention_everyone  : bool
$mention_roles  : ExCollectionInterface<string|int, ?Role>|array<string, ?Role>
$mentions  : ExCollectionInterface<string|int, User>|array<string|int, User>
$message_reference  : MessageReference|null
$message_snapshot  : MessageSnapshot|null
$message_snapshots  : ExCollectionInterface<string|int, MessageSnapshot>|array<string|int, MessageSnapshot>
$moderation_metadata  : ?array<string|int, mixed>|null
$nonce  : string|null
$pinned  : bool
$poll  : Poll|null
$position  : int|null
$reactions  : ReactionRepository
$recipient_id  : string|null
$referenced_message  : ?Message|null
$resolved  : Resolved|null
$role_subscription_data  : RoleSubscriptionData|null
$scriptData  : mixed
Custom script data.
$shared_client_theme  : SharedClientTheme|null
$source_message_deleted  : bool
$sticker_items  : ExCollectionInterface<string|int, Sticker>|array<string|int, Sticker>
$suppress_embeds  : bool
$suppress_notifications  : bool
$thread  : Thread|null
$timestamp  : Carbon
$tts  : bool
$type  : int
$urgent  : bool
$user_id  : string|null
$webhook_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>
Debug representation for `var_dump()`.
__get()  : mixed
Handles dynamic get calls onto the part.
__serialize()  : array<string|int, mixed>
The raw attributes, for PHP native serialization.
__set()  : void
Handles dynamic set calls onto the part.
__toString()  : string
Converts the part to a string.
__unserialize()  : void
Restores attributes from PHP native unserialization.
addEmbed()  : PromiseInterface
Not available: the bot is not in the DM.
createReactionCollector()  : PromiseInterface
Not available: the bot receives no reactions from the DM, so the collector would never collect anything.
crosspost()  : PromiseInterface
Not available: the bot is not in the DM.
delayedDelete()  : PromiseInterface
Not available: the bot is not in the DM.
delayedReply()  : PromiseInterface
Not available: the bot is not in the DM.
delete()  : PromiseInterface
Not available: the bot is not in the DM.
deleteAllReactions()  : PromiseInterface
Not available: the bot is not in the DM.
deleteEmojiReactions()  : PromiseInterface
Not available: the bot is not in the DM.
deleteOwnReaction()  : PromiseInterface
Not available: the bot is not in the DM.
deleteReaction()  : PromiseInterface
Not available: the bot is not in the DM.
deleteUserReaction()  : PromiseInterface
Not available: the bot is not in the DM.
edit()  : PromiseInterface
Not available: the bot is not in the DM.
fetch()  : PromiseInterface
Not available: the bot is not in the DM.
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.
getLinkAttribute()  : string|null
Returns the message link attribute.
getPublicAttributes()  : array<string|int, mixed>
Returns an array of public attributes.
getRawAttributes()  : array<string|int, mixed>
Returns an array of raw attributes.
getRepository()  : MessageRepository|WebhookMessageRepository
Gets the originating repository of the part.
getRepositoryAttributes()  : array<string|int, mixed>
The attributes the owning repository binds into its endpoint URIs.
getUpdatableAttributes()  : array<string|int, mixed>
The attribute subset sent when updating this Part (PATCH).
isDeletable()  : bool
The bot cannot delete a message in a DM it is not in.
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.
react()  : PromiseInterface
Not available: the bot is not in the DM.
reply()  : PromiseInterface
Not available: the bot is not in the DM.
save()  : PromiseInterface
Not available: the bot is not in the DM.
serialize()  : ?string
Serializes the data. Used for Serializable.
startThread()  : PromiseInterface
Not available: the bot is not in the DM.
unserialize()  : void
Unserializes some data and stores it. Used for Serializable.
updateModerationMetadata()  : PromiseInterface
Sets the moderation metadata on this message, which is delivered to the players' clients.
afterConstruct()  : void
Called after the part has been constructed.
attributeCarbonHelper()  : Carbon|null
Helps with getting ISO8601 timestamp attributes.
attributeCollectionHelper()  : ExCollectionInterface
Helps with getting Part attributes.
attributePartHelper()  : Part|null
Helps with getting Part attributes.
attributeTypedCollectionHelper()  : ExCollectionInterface
Helps with getting Part attributes for classes with extended types.
checkForGetMutator()  : string|false
Checks if there is a get mutator present.
checkForSetMutator()  : string|false
Checks if there is a set mutator present.
getActivityAttribute()  : ?Activity
Returns the activity sent with Rich Presence-related chat embeds.
getApplicationAttribute()  : ?Application
Returns the application sent with Rich Presence-related chat embeds.
getAttachmentsAttribute()  : ExCollectionInterface<string|int, Attachment>|array<string|int, Attachment>
Returns any attached files.
getAttribute()  : mixed
Gets an attribute on the part.
getAuthorAttribute()  : User|null
Returns the author attribute.
getCallAttribute()  : MessageCall|null
Returns the call attribute.
getChannelAttribute()  : Channel
Gets the channel attribute.
getComponentsAttribute()  : ExCollectionInterface<string|int, Component>|array<string|int, Component>
Returns the components attribute.
getCrosspostedAttribute()  : bool
Gets the crossposted attribute.
getEditedTimestampAttribute()  : Carbon|null
Returns the edited_timestamp attribute.
getEmbedsAttribute()  : ExCollectionInterface<string|int, Embed>|array<string|int, Embed>
Returns the embed attribute.
getEphemeralAttribute()  : bool
Gets the ephemeral attribute.
getFailedToMentionSomeRolesInThreadAttribute()  : bool
Gets the failed to mention some roles in thread attribute.
getGuildAttribute()  : Guild|null
Returns the guild which the channel that the message was sent in belongs to.
getHasThreadAttribute()  : bool
Gets the has thread attribute.
getInteractionAttribute()  : MessageInteraction|null
Gets the interaction which triggered the message (application commands).
getInteractionMetadataAttribute()  : MessageInteractionMetadata|null
Returns the interaction_metadata attribute, if present.
getIsCrosspostAttribute()  : bool
Gets the is_crosspost attribute.
getLoadingAttribute()  : bool
Gets the loading attribute.
getMemberAttribute()  : Member|null
Returns the member attribute.
getMentionChannelsAttribute()  : ExCollectionInterface<string|int, Channel>|array<string|int, Channel>
Gets the mention_channels attribute.
getMentionRolesAttribute()  : ExCollectionInterface<string|int, ?Role>|array<string, ?Role>
Returns the mention_roles attribute.
getMentionsAttribute()  : ExCollectionInterface<string|int, User>|array<string|int, User>
Returns the mention attribute.
getMessageReferenceAttribute()  : ?MessageReference
Gets the `message_reference` attribute.
getMessageSnapshotAttribute()  : Message|null
Returns the message_snapshot attribute, if present.
getMessageSnapshotsAttribute()  : ExCollectionInterface<string|int, MessageSnapshot>|array<string|int, MessageSnapshot>
Returns the message_snapshot attribute, if present.
getPollAttribute()  : Poll|null
Returns the poll attribute.
getRecipientIdAttribute()  : string|null
Gets the recipient_id attribute.
getReferencedMessageAttribute()  : Message|null
Gets the referenced message attribute, if present.
getResolvedAttribute()  : Resolved|null
Returns the resolved attribute.
getRoleSubscriptionDataAttribute()  : RoleSubscriptionData|null
Returns the role_subscription_data attribute.
getSharedClientThemeAttribute()  : SharedClientTheme|null
Returns the shared_client_theme attribute.
getSourceMessageDeletedAttribute()  : bool
Gets the source_message_deleted attribute.
getStickerItemsAttribute()  : ExCollectionInterface<string|int, Sticker>|array<string|int, Sticker>
Returns the sticker_items attribute.
getSuppressEmbedsAttribute()  : bool
Gets the suppress_embeds attribute.
getSuppressNotificationsAttribute()  : bool
Gets the suppress notification attribute.
getThreadAttribute()  : Thread|null
Returns the thread that was started from this message, includes thread member object.
getTimestampAttribute()  : Carbon|null
Returns the timestamp attribute.
getUrgentAttribute()  : bool
Gets the urgent attribute.
getUserIdAttribute()  : string|null
Returns the `user_id` attribute.
makeOptionalAttributes()  : array<string|int, mixed>
Return key-value attributes if it has been filled.
notInChannel()  : PromiseInterface
Rejects a call that would act through the DM channel.
setAttribute()  : void
Sets an attribute on the part.
setReactionsAttribute()  : void
Sets the reactions attribute.
studly()  : string
Converts a string to studlyCase.

Constants

CHANNEL_FOLLOW_ADD

Use Message::TYPE_CHANNEL_FOLLOW_ADD

public mixed CHANNEL_FOLLOW_ADD = self::TYPE_CHANNEL_FOLLOW_ADD

CHANNEL_PINNED_MESSAGE

Use Message::TYPE_CHANNEL_PINNED_MESSAGE

public mixed CHANNEL_PINNED_MESSAGE = self::TYPE_CHANNEL_PINNED_MESSAGE

FLAG_CROSSPOSTED

This message has been published to subscribed channels (via Channel Following).

public mixed FLAG_CROSSPOSTED = 1 << 0

FLAG_EPHEMERAL

This message is only visible to the user who invoked the Interaction.

public mixed FLAG_EPHEMERAL = 1 << 6

FLAG_FAILED_TO_MENTION_SOME_ROLES_IN_THREAD

This message failed to mention some roles and add their members to the thread.

public mixed FLAG_FAILED_TO_MENTION_SOME_ROLES_IN_THREAD = 1 << 8

FLAG_HAS_SNAPSHOT

This message has a snapshot (via Message Forwarding).

public mixed FLAG_HAS_SNAPSHOT = 1 << 14

FLAG_HAS_THREAD

This message has an associated thread, with the same id as the message.

public mixed FLAG_HAS_THREAD = 1 << 5

FLAG_IS_COMPONENTS_V2

Allows you to create fully component-driven messages. Once a message has been sent with this flag, it can't be removed from that message.

public mixed FLAG_IS_COMPONENTS_V2 = 1 << 15

FLAG_IS_CROSSPOST

This message originated from a message in another channel (via Channel Following).

public mixed FLAG_IS_CROSSPOST = 1 << 1

FLAG_IS_V2_COMPONENTS

Use Message::FLAG_IS_COMPONENTS_V2 instead.

public mixed FLAG_IS_V2_COMPONENTS = 1 << 15

FLAG_IS_VOICE_MESSAGE

This message is a voice message.

public mixed FLAG_IS_VOICE_MESSAGE = 1 << 13

FLAG_LOADING

This message is an Interaction Response and the bot is "thinking".

public mixed FLAG_LOADING = 1 << 7

FLAG_SOURCE_MESSAGE_DELETED

The source message for this crosspost has been deleted (via Channel Following).

public mixed FLAG_SOURCE_MESSAGE_DELETED = 1 << 3

FLAG_SUPPRESS_EMBED

Use Message::FLAG_SUPPRESS_EMBEDS instead.

public mixed FLAG_SUPPRESS_EMBED = 1 << 2

FLAG_SUPPRESS_EMBEDS

Do not include any embeds when serializing this message.

public mixed FLAG_SUPPRESS_EMBEDS = 1 << 2

FLAG_SUPPRESS_NOTIFICATIONS

This message will not trigger push and desktop notifications.

public mixed FLAG_SUPPRESS_NOTIFICATIONS = 1 << 12

FLAG_URGENT

This message came from the urgent message system.

public mixed FLAG_URGENT = 1 << 4

GUILD_DISCOVERY_DISQUALIFIED

Use Message::TYPE_GUILD_DISCOVERY_DISQUALIFIED

public mixed GUILD_DISCOVERY_DISQUALIFIED = self::TYPE_GUILD_DISCOVERY_DISQUALIFIED

GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING

Use Message::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING

public mixed GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = self::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING

GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING

Use Message::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING

public mixed GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = self::TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING

GUILD_DISCOVERY_REQUALIFIED

Use Message::TYPE_GUILD_DISCOVERY_REQUALIFIED

public mixed GUILD_DISCOVERY_REQUALIFIED = self::TYPE_GUILD_DISCOVERY_REQUALIFIED

GUILD_MEMBER_JOIN

Use Message::TYPE_USER_JOIN

public mixed GUILD_MEMBER_JOIN = self::TYPE_USER_JOIN

REACT_DELETE_ALL

public mixed REACT_DELETE_ALL = 0

REACT_DELETE_EMOJI

public mixed REACT_DELETE_EMOJI = 3

REACT_DELETE_ID

public mixed REACT_DELETE_ID = 2

REACT_DELETE_ME

public mixed REACT_DELETE_ME = 1

REFERENCE_DEFAULT

A standard reference used by replies.

public mixed REFERENCE_DEFAULT = 0

REFERENCE_FORWARD

Reference used to point to a message at a point in time.

public mixed REFERENCE_FORWARD = 1

TYPE_APPLICATION_COMMAND

Use Message::TYPE_CHAT_INPUT_COMMAND

public mixed TYPE_APPLICATION_COMMAND = self::TYPE_CHAT_INPUT_COMMAND

TYPE_AUTO_MODERATION_ACTION

public mixed TYPE_AUTO_MODERATION_ACTION = 24

TYPE_CALL

public mixed TYPE_CALL = 3

TYPE_CHANNEL_FOLLOW_ADD

public mixed TYPE_CHANNEL_FOLLOW_ADD = 12

TYPE_CHANNEL_ICON_CHANGE

public mixed TYPE_CHANNEL_ICON_CHANGE = 5

TYPE_CHANNEL_NAME_CHANGE

public mixed TYPE_CHANNEL_NAME_CHANGE = 4

TYPE_CHANNEL_PINNED_MESSAGE

public mixed TYPE_CHANNEL_PINNED_MESSAGE = 6

TYPE_CHAT_INPUT_COMMAND

public mixed TYPE_CHAT_INPUT_COMMAND = 20

TYPE_CONTEXT_MENU_COMMAND

public mixed TYPE_CONTEXT_MENU_COMMAND = 23

TYPE_DEFAULT

public mixed TYPE_DEFAULT = 0

TYPE_EMOJI_ADDED

public mixed TYPE_EMOJI_ADDED = 63

TYPE_GUILD_APPLICATION_PREMIUM_SUBSCRIPTION

public mixed TYPE_GUILD_APPLICATION_PREMIUM_SUBSCRIPTION = 32

TYPE_GUILD_BOOST

public mixed TYPE_GUILD_BOOST = 8

TYPE_GUILD_BOOST_TIER_1

public mixed TYPE_GUILD_BOOST_TIER_1 = 9

TYPE_GUILD_BOOST_TIER_2

public mixed TYPE_GUILD_BOOST_TIER_2 = 10

TYPE_GUILD_BOOST_TIER_3

public mixed TYPE_GUILD_BOOST_TIER_3 = 11

TYPE_GUILD_DISCOVERY_DISQUALIFIED

public mixed TYPE_GUILD_DISCOVERY_DISQUALIFIED = 14

TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING

public mixed TYPE_GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17

TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING

public mixed TYPE_GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16

TYPE_GUILD_DISCOVERY_REQUALIFIED

public mixed TYPE_GUILD_DISCOVERY_REQUALIFIED = 15

TYPE_GUILD_INCIDENT_ALERT_MODE_DISABLED

public mixed TYPE_GUILD_INCIDENT_ALERT_MODE_DISABLED = 37

TYPE_GUILD_INCIDENT_ALERT_MODE_ENABLED

public mixed TYPE_GUILD_INCIDENT_ALERT_MODE_ENABLED = 36

TYPE_GUILD_INCIDENT_REPORT_FALSE_ALARM

public mixed TYPE_GUILD_INCIDENT_REPORT_FALSE_ALARM = 39

TYPE_GUILD_INCIDENT_REPORT_RAID

public mixed TYPE_GUILD_INCIDENT_REPORT_RAID = 38

TYPE_GUILD_INVITE_REMINDER

public mixed TYPE_GUILD_INVITE_REMINDER = 22

TYPE_INTERACTION_PREMIUM_UPSELL

public mixed TYPE_INTERACTION_PREMIUM_UPSELL = 26

TYPE_NORMAL

Use Message::TYPE_DEFAULT

public mixed TYPE_NORMAL = self::TYPE_DEFAULT

TYPE_POLL_RESULT

public mixed TYPE_POLL_RESULT = 46

TYPE_PREMIUM_GROUP_INVITE

public mixed TYPE_PREMIUM_GROUP_INVITE = 64

TYPE_PURCHASE_NOTIFICATION

public mixed TYPE_PURCHASE_NOTIFICATION = 44

TYPE_RECIPIENT_ADD

public mixed TYPE_RECIPIENT_ADD = 1

TYPE_RECIPIENT_REMOVE

public mixed TYPE_RECIPIENT_REMOVE = 2

TYPE_REPLY

public mixed TYPE_REPLY = 19

TYPE_ROLE_SUBSCRIPTION_PURCHASE

public mixed TYPE_ROLE_SUBSCRIPTION_PURCHASE = 25

TYPE_STAGE_END

public mixed TYPE_STAGE_END = 28

TYPE_STAGE_SPEAKER

public mixed TYPE_STAGE_SPEAKER = 29

TYPE_STAGE_START

public mixed TYPE_STAGE_START = 27

TYPE_STAGE_TOPIC

public mixed TYPE_STAGE_TOPIC = 31

TYPE_THREAD_CREATED

public mixed TYPE_THREAD_CREATED = 18

TYPE_THREAD_STARTER_MESSAGE

public mixed TYPE_THREAD_STARTER_MESSAGE = 21

TYPE_USER_ADDED

Use Message::TYPE_RECIPIENT_ADD

public mixed TYPE_USER_ADDED = self::TYPE_RECIPIENT_ADD

TYPE_USER_JOIN

public mixed TYPE_USER_JOIN = 7

TYPE_USER_REMOVED

Use Message::TYPE_RECIPIENT_REMOVE

public mixed TYPE_USER_REMOVED = self::TYPE_RECIPIENT_REMOVE

USER_PREMIUM_GUILD_SUBSCRIPTION

Use Message::TYPE_GUILD_BOOST

public mixed USER_PREMIUM_GUILD_SUBSCRIPTION = self::TYPE_GUILD_BOOST

USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1

Use Message::TYPE_GUILD_BOOST_TIER_1

public mixed USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = self::TYPE_GUILD_BOOST_TIER_1

USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2

Use Message::TYPE_GUILD_BOOST_TIER_2

public mixed USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = self::TYPE_GUILD_BOOST_TIER_2

USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3

Use Message::TYPE_GUILD_BOOST_TIER_3

public mixed USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = self::TYPE_GUILD_BOOST_TIER_3

GAME_FILLABLE

The fields Discord adds to a message for these events.

protected mixed GAME_FILLABLE = ['channel', 'recipient_id', 'lobby_id', 'moderation_metadata']

Properties

$activity

public Activity|null $activity

Current message activity. Sent with Rich Presence-related chat embeds.

$application

public Application|null $application

Application of message. Sent with Rich Presence-related chat embeds.

$application_id

public string|null $application_id

If the message is a response to an Interaction, this is the id of the interaction's application.

$attachments

public ExCollectionInterface<string|int, Attachment>|array<string|int, Attachment> $attachments

Collection of attachment objects. This will be empty if the message has the IS_COMPONENTS_V2 flag (1 << 15) set and attachments will instead be included within the components field.

$author

public User|null $author

The author of the message. Will be a webhook if sent from one.

$channel_id

public string $channel_id

The unique identifier of the channel that the message was sent in.

$channel_type

public int|null $channel_type

The type of channel the message was sent in.

$components

public ExCollectionInterface<string|int, Component>|array<string|int, Component> $components

Sent if the message contains components like buttons, action rows, or other interactive components.

$content

public string $content

The content of the message if it is a normal message.

$created

Is the part already created in the Discord servers?

public bool $created = false

Whether the part has been created.

$crossposted read-only

public bool $crossposted

Message has been crossposted.

$edited_timestamp

public ?Carbon|null $edited_timestamp

A timestamp of when the message was edited, or null.

$embeds

public ExCollectionInterface<string|int, Embed>|array<string|int, Embed> $embeds

A collection of embed objects.

$ephemeral read-only

public bool $ephemeral

Whether this message is only visible to the user who invoked the Interaction.

$failed_to_mention_some_roles_in_thread read-only

public bool $failed_to_mention_some_roles_in_thread

This message failed to mention some roles and add their members to the thread.

$flags

public int|null $flags

Message flags.

$guild read-only

public Guild|null $guild

The guild that the message was sent in.

$guild_id

public string|null $guild_id

The unique identifier of the guild that the channel the message was sent in belongs to.

$has_thread read-only

public bool $has_thread

Whether this message has an associated thread, with the same id as the message.

$id

public string $id

The unique identifier of the message.

$is_crosspost read-only

public bool $is_crosspost

Message is a crosspost from another channel.

public string|null $link

Returns a link to the message.

$loading read-only

public bool $loading

Whether this message is an Interaction Response and the bot is "thinking".

$lobby_id

public string|null $lobby_id

The lobby, for a message in a linked channel.

$member

public Member|null $member

The member that sent this message, or null if it was in a private message.

$mention_channels

public ExCollectionInterface<string|int, Channel>|array<string|int, Channel> $mention_channels

Collection of mentioned channels.

$mention_everyone

public bool $mention_everyone

Whether the message contained an @everyone mention.

$mention_roles

public ExCollectionInterface<string|int, ?Role>|array<string, ?Role> $mention_roles

A collection of roles that were mentioned in the message.

$mentions

public ExCollectionInterface<string|int, User>|array<string|int, User> $mentions

A collection of the users mentioned in the message.

$message_reference

public MessageReference|null $message_reference

Message that is referenced by this message. Data showing the source of a crosspost, channel follow add, pin, or reply message.

$message_snapshot read-only

public MessageSnapshot|null $message_snapshot

The first message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.).

$message_snapshots

public ExCollectionInterface<string|int, MessageSnapshot>|array<string|int, MessageSnapshot> $message_snapshots

The messages associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.).

$nonce

public string|null $nonce

A randomly generated string that provides verification for the client. Not required.

$pinned

public bool $pinned

Whether the message is pinned to the channel.

$poll

public Poll|null $poll

The poll attached to the message.

$position

public int|null $position

A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread.

$referenced_message

public ?Message|null $referenced_message

The message that is referenced in a reply.

$resolved

public Resolved|null $resolved

Data for users, members, channels, and roles in the message's auto-populated select menus

$role_subscription_data

public RoleSubscriptionData|null $role_subscription_data

Data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message.

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

$shared_client_theme

public SharedClientTheme|null $shared_client_theme

The custom client-side theme shared via the message.

$source_message_deleted read-only

public bool $source_message_deleted

Source message for this message has been deleted.

$sticker_items

public ExCollectionInterface<string|int, Sticker>|array<string|int, Sticker> $sticker_items

Stickers attached to the message.

$suppress_embeds read-only

public bool $suppress_embeds

Do not include embeds when serializing message.

$suppress_notifications read-only

public bool $suppress_notifications

This message will not trigger push and desktop notifications.

$thread

public Thread|null $thread

The thread that was started from this message, includes thread member object.

$timestamp

public Carbon $timestamp

A timestamp of when the message was sent.

$tts

public bool $tts

Whether the message was sent as a text-to-speech message.

$type

public int $type

The type of message.

$urgent read-only

public bool $urgent

Message is urgent.

$user_id read-only

public string|null $user_id

The user id of the author.

$webhook_id

public string|null $webhook_id

ID of the webhook that made the message, if any.

$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 = [ 'id', 'channel_id', 'channel_type', 'author', 'content', 'timestamp', 'edited_timestamp', 'tts', 'mention_everyone', 'mentions', 'mention_roles', 'mention_channels', 'attachments', 'embeds', 'nonce', 'pinned', 'webhook_id', 'type', 'activity', 'application', 'application_id', 'flags', 'message_reference', 'message_snapshot', 'message_snapshots', 'referenced_message', 'interaction_metadata', 'interaction', 'thread', 'components', 'sticker_items', 'position', 'role_subscription_data', 'resolved', 'poll', 'call', // @internal 'guild_id', 'member', // repositories 'reactions', ]

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 = ['reactions' => \Discord\Repository\Channel\ReactionRepository::class]

Repositories.

Tags
inheritDoc

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

Tags
inheritDoc

__debugInfo()

Debug representation for `var_dump()`.

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()

The raw attributes, for PHP native serialization.

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()

Restores attributes from PHP native unserialization.

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

addEmbed()

Not available: the bot is not in the DM.

public addEmbed(Embed $embed) : PromiseInterface
Parameters
$embed : Embed
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

createReactionCollector()

Not available: the bot receives no reactions from the DM, so the collector would never collect anything.

public createReactionCollector(callable $filter[, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
$filter : callable

The filter function. Returns true or false.

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

['limit'] The amount of reactions allowed or false.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

crosspost()

Not available: the bot is not in the DM.

public crosspost() : PromiseInterface
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

delayedDelete()

Not available: the bot is not in the DM.

public delayedDelete(int $delay[, mixed &$timer = null ]) : PromiseInterface
Parameters
$delay : int

Time to delay the delete by, in milliseconds.

$timer : mixed = null

Delay timer passed by reference.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException, and sets no timer.

delayedReply()

Not available: the bot is not in the DM.

public delayedReply(mixed $message, int $delay[, mixed &$timer = null ]) : PromiseInterface
Parameters
$message : mixed

Reply message to send after delay.

$delay : int

Delay after text will be sent in milliseconds.

$timer : mixed = null

Delay timer passed by reference.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException, and sets no timer.

delete()

Not available: the bot is not in the DM.

public delete([?string $reason = null ]) : PromiseInterface
Parameters
$reason : ?string = null

Reason for Audit Log (if supported).

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

deleteAllReactions()

Not available: the bot is not in the DM.

public deleteAllReactions() : PromiseInterface
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

deleteEmojiReactions()

Not available: the bot is not in the DM.

public deleteEmojiReactions(mixed $emoticon) : PromiseInterface
Parameters
$emoticon : mixed
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

deleteOwnReaction()

Not available: the bot is not in the DM.

public deleteOwnReaction(mixed $emoticon) : PromiseInterface
Parameters
$emoticon : mixed
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

deleteReaction()

Not available: the bot is not in the DM.

public deleteReaction(int $type[, mixed $emoticon = null ][, ?string $id = null ]) : PromiseInterface
Parameters
$type : int

The type of deletion to perform.

$emoticon : mixed = null

The emoticon to delete (if not all).

$id : ?string = null

The user reaction to delete (if not all).

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

deleteUserReaction()

Not available: the bot is not in the DM.

public deleteUserReaction(mixed $emoticon, string $user_id) : PromiseInterface
Parameters
$emoticon : mixed
$user_id : string
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

edit()

Not available: the bot is not in the DM.

public edit(MessageBuilder $message) : PromiseInterface
Parameters
$message : MessageBuilder

Contains the new contents of the message. Note that fields not specified in the builder will not be overwritten.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

fetch()

Not available: the bot is not in the DM.

public fetch() : PromiseInterface
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

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>

getLinkAttribute()

Returns the message link attribute.

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

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()

The attributes the owning repository binds into its endpoint URIs.

public getRepositoryAttributes() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

isDeletable()

The bot cannot delete a message in a DM it is not in.

public isDeletable() : bool
Return values
bool —

Always false.

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.

react()

Not available: the bot is not in the DM.

public react(mixed $emoticon) : PromiseInterface
Parameters
$emoticon : mixed

The emoticon to react with. (custom: ':michael:251127796439449631')

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

reply()

Not available: the bot is not in the DM.

public reply(mixed $message) : PromiseInterface
Parameters
$message : mixed

The reply message.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

save()

Not available: the bot is not in the DM.

public save([?string $reason = null ]) : PromiseInterface
Parameters
$reason : ?string = null
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

serialize()

Serializes the data. Used for Serializable.

public serialize() : ?string
Return values
?string —

A string of serialized data.

startThread()

Not available: the bot is not in the DM.

public startThread(array<string|int, mixed>|string $options[, string|null|int $reason = null ][, ?string $_reason = null ]) : PromiseInterface
Parameters
$options : array<string|int, mixed>|string

['rate_limit_per_user'] Amount of seconds a user has to wait before sending another message (0-21600).

$reason : string|null|int = null

Reason for Audit Log.

$_reason : ?string = null
Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

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.

updateModerationMetadata()

Sets the moderation metadata on this message, which is delivered to the players' clients.

public updateModerationMetadata(array<string|int, mixed> $metadata) : PromiseInterface

Discord clears it whenever the message is edited, and sends GAME_DIRECT_MESSAGE_UPDATE so it can be moderated again.

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

Up to 5 free-form string key/value pairs describing the decision, e.g. ['action' => 'hide', 'reason' => 'toxicity'].

Tags
link
https://docs.discord.com/developers/discord-social-sdk/how-to/integrate-moderation#applying-moderation-decisions
Return values
PromiseInterface —

Rejects with a \DomainException when the event did not say who the other user is.

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void

attributeCarbonHelper()

Helps with getting ISO8601 timestamp attributes.

protected attributeCarbonHelper(string $key) : Carbon|null
Parameters
$key : string

The attribute key.

Tags
throws
Exception
since
10.19.0
Return values
Carbon|null

attributeCollectionHelper()

Helps with getting Part attributes.

protected attributeCollectionHelper(string $key, string $class[, ?string $discrim = 'id' ][, ?array<string|int, mixed> $extraData = [] ]) : ExCollectionInterface
Parameters
$key : string

The attribute key.

$class : string

The attribute class.

$discrim : ?string = 'id'

The attribute discriminator.

$extraData : ?array<string|int, mixed> = []
Tags
throws
Exception
since
10.19.0
Return values
ExCollectionInterface

attributePartHelper()

Helps with getting Part attributes.

protected attributePartHelper(string $key, string $class[, array<string|int, mixed> $extraData = [] ]) : Part|null
Parameters
$key : string

The attribute key.

$class : string

The attribute class.

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

Extra data to pass to the part constructor.

Tags
throws
Exception
since
10.19.0
Return values
Part|null

attributeTypedCollectionHelper()

Helps with getting Part attributes for classes with extended types.

protected attributeTypedCollectionHelper(string $class, string $key) : ExCollectionInterface
Parameters
$class : string

The attribute class.

$key : string

The attribute key.

Return values
ExCollectionInterface

checkForGetMutator()

Checks if there is a get mutator present.

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

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

getActivityAttribute()

Returns the activity sent with Rich Presence-related chat embeds.

protected getActivityAttribute() : ?Activity
Return values
?Activity

getApplicationAttribute()

Returns the application sent with Rich Presence-related chat embeds.

protected getApplicationAttribute() : ?Application
Return values
?Application

getAttachmentsAttribute()

Returns any attached files.

protected getAttachmentsAttribute() : ExCollectionInterface<string|int, Attachment>|array<string|int, Attachment>
Return values
ExCollectionInterface<string|int, Attachment>|array<string|int, Attachment> —

Attachment objects.

getAttribute()

Gets an attribute on the part.

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

getAuthorAttribute()

Returns the author attribute.

protected getAuthorAttribute() : User|null
Return values
User|null —

The author of the message.

getChannelAttribute()

Gets the channel attribute.

protected getChannelAttribute() : Channel

Always a DM or group DM, never a thread, so it narrows Message's Channel|Thread.

Return values
Channel —

The DM channel Discord attached, else the cached private channel, else a DM with only the author.

getComponentsAttribute()

Returns the components attribute.

protected getComponentsAttribute() : ExCollectionInterface<string|int, Component>|array<string|int, Component>
Return values
ExCollectionInterface<string|int, Component>|array<string|int, Component>

getCrosspostedAttribute()

Gets the crossposted attribute.

protected getCrosspostedAttribute() : bool
Return values
bool

getEditedTimestampAttribute()

Returns the edited_timestamp attribute.

protected getEditedTimestampAttribute() : Carbon|null
Tags
throws
Exception
Return values
Carbon|null —

The time that the message was edited.

getEmbedsAttribute()

Returns the embed attribute.

protected getEmbedsAttribute() : ExCollectionInterface<string|int, Embed>|array<string|int, Embed>
Return values
ExCollectionInterface<string|int, Embed>|array<string|int, Embed> —

A collection of embeds.

getEphemeralAttribute()

Gets the ephemeral attribute.

protected getEphemeralAttribute() : bool
Return values
bool

getFailedToMentionSomeRolesInThreadAttribute()

Gets the failed to mention some roles in thread attribute.

protected getFailedToMentionSomeRolesInThreadAttribute() : bool
Return values
bool

getGuildAttribute()

Returns the guild which the channel that the message was sent in belongs to.

protected getGuildAttribute() : Guild|null
Return values
Guild|null

getHasThreadAttribute()

Gets the has thread attribute.

protected getHasThreadAttribute() : bool
Return values
bool

getIsCrosspostAttribute()

Gets the is_crosspost attribute.

protected getIsCrosspostAttribute() : bool
Return values
bool

getLoadingAttribute()

Gets the loading attribute.

protected getLoadingAttribute() : bool
Return values
bool

getMemberAttribute()

Returns the member attribute.

protected getMemberAttribute() : Member|null
Return values
Member|null —

The member that sent the message, or null if it was in a private message.

getMentionChannelsAttribute()

Gets the mention_channels attribute.

protected getMentionChannelsAttribute() : ExCollectionInterface<string|int, Channel>|array<string|int, Channel>
Return values
ExCollectionInterface<string|int, Channel>|array<string|int, Channel>

getMentionRolesAttribute()

Returns the mention_roles attribute.

protected getMentionRolesAttribute() : ExCollectionInterface<string|int, ?Role>|array<string, ?Role>
Return values
ExCollectionInterface<string|int, ?Role>|array<string, ?Role> —

The roles that were mentioned. Null role only contains the ID as the key in the collection.

getMentionsAttribute()

Returns the mention attribute.

protected getMentionsAttribute() : ExCollectionInterface<string|int, User>|array<string|int, User>
Return values
ExCollectionInterface<string|int, User>|array<string|int, User> —

The users that were mentioned.

getMessageSnapshotAttribute()

Returns the message_snapshot attribute, if present.

protected getMessageSnapshotAttribute() : Message|null

Use getMessageSnapshotsAttribute().

For forwarded messages, this contains a snapshot of the original message.

Return values
Message|null

getMessageSnapshotsAttribute()

Returns the message_snapshot attribute, if present.

protected getMessageSnapshotsAttribute() : ExCollectionInterface<string|int, MessageSnapshot>|array<string|int, MessageSnapshot>

For forwarded messages, this contains a snapshot of the original message.

Return values
ExCollectionInterface<string|int, MessageSnapshot>|array<string|int, MessageSnapshot>

getPollAttribute()

Returns the poll attribute.

protected getPollAttribute() : Poll|null
Return values
Poll|null

getRecipientIdAttribute()

Gets the recipient_id attribute.

protected getRecipientIdAttribute() : string|null
Return values
string|null —

The other user in the DM, from recipient_id or else the channel's recipients.

getReferencedMessageAttribute()

Gets the referenced message attribute, if present.

protected getReferencedMessageAttribute() : Message|null
Return values
Message|null

getResolvedAttribute()

Returns the resolved attribute.

protected getResolvedAttribute() : Resolved|null
Return values
Resolved|null

getSourceMessageDeletedAttribute()

Gets the source_message_deleted attribute.

protected getSourceMessageDeletedAttribute() : bool
Return values
bool

getStickerItemsAttribute()

Returns the sticker_items attribute.

protected getStickerItemsAttribute() : ExCollectionInterface<string|int, Sticker>|array<string|int, Sticker>
Return values
ExCollectionInterface<string|int, Sticker>|array<string|int, Sticker> —

Partial stickers.

getSuppressEmbedsAttribute()

Gets the suppress_embeds attribute.

protected getSuppressEmbedsAttribute() : bool
Return values
bool

getSuppressNotificationsAttribute()

Gets the suppress notification attribute.

protected getSuppressNotificationsAttribute() : bool
Return values
bool

getThreadAttribute()

Returns the thread that was started from this message, includes thread member object.

protected getThreadAttribute() : Thread|null
Tags
since
10.0.0

This only returns a thread that was started on this message, not the thread of the message.

7.0.0
Return values
Thread|null

getTimestampAttribute()

Returns the timestamp attribute.

protected getTimestampAttribute() : Carbon|null
Tags
throws
Exception
Return values
Carbon|null —

The time that the message was sent.

getUrgentAttribute()

Gets the urgent attribute.

protected getUrgentAttribute() : bool
Return values
bool

getUserIdAttribute()

Returns the `user_id` attribute.

protected getUserIdAttribute() : string|null
Return values
string|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>

notInChannel()

Rejects a call that would act through the DM channel.

protected notInChannel(string $method) : PromiseInterface
Parameters
$method : string

The method called.

Return values
PromiseInterface —

Rejects with a \BadMethodCallException.

setAttribute()

Sets an attribute on the part.

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

The key to the attribute.

$value : mixed

The value of the attribute.

setReactionsAttribute()

Sets the reactions attribute.

protected setReactionsAttribute(?array<string|int, mixed> $reactions) : void
Parameters
$reactions : ?array<string|int, mixed>

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