MessageBuilder - discord-php/DiscordPHP GitHub Wiki

Class dedicated to composing messages.

use Discord\Builders\MessageBuilder;

Methods

addAttachment()

addComponent()

addEmbed()

addFile()

addFileFromContent()

addSticker()

clearAttachments()

clearFiles()

getAttachments()

getComponents()

getStickers()

getTts()

new()

numFiles()

removeComponent()

removeSticker()

setAllowedMentions()

setComponent()

setContent()

setEmbeds()

setNonce()

setReplyTo()

setStickers()

setTts()


Create a message with a webhook

To send a Message you must have the Channel object and, in this case, the Embed object!

$embed = $discord->factory(Embed::class)->setDescription('oh no an embed!');
$channel->sendMessage(MessageBuilder::new()->addEmbed($embed));