-
Notifications
You must be signed in to change notification settings - Fork 237
Message
Messages are part of Channel (Text Channel or Direct Message)
use Discord\Parts\Channel\Message;
-
ReactionRepository
$message->reactions
Requires GUILD_MESSAGES
intent for guild, or DIRECT_MESSAGES
intent for direct message
You must first get the Channel object to use the code below. Change 123123123123123123
below with the Message ID you want to retrieve
Cached, synchrounous:
$message = $channel->messages->get('id', '123123123123123123');
Message can be also retrieved from related objects:
-
Message
$reply = $message->referenced_message;
reply referenced to the message -
Reaction
$message = $reaction->message;
message where the reaction is part of
If the code above returns null
, you may need to fetch it first (Promise, asynchrounous):
$channel->messages->fetch('123123123123123123')->then(function (Message $message) {
// ...
})->done();
https://discord.com/developers/docs/resources/channel#get-channel-message
You must first get the Message object to use the code below.
$message->delete()->then(function (Message $message) {
// ...
})->done();
You must first get the Message object to use the code below. You also need the MessageBuilder to create a message.
$message->edit(MessageBuilder::new()->setContent('new message content!'))->then(function (Message $message) {
// ...
})->done();
Note: This wiki is currently Work In Progress. Consider reading the docs instead.
- Application Command (Slash based)
Command Client (Message based)
- Activity
- Application
- Guild
- Private Channel
- User
Components
-
ActionRow
- Buttons
- Option (commands)
- SelectMenu
- TextInput
Builders