Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add MessageBuilder::getEmbeds() and MessageBuilder::getPoll() #1265

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/Discord/Builders/MessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ public function setPoll(Poll|null $poll): self
return $this;
}

/**
* Returns the poll of the message.
*
* @return Poll|null
*/
public function getPoll(): ?Poll
{
return $this->poll;
}

/**
* Override the default username of the webhook. Only used for executing webhook.
*
Expand Down Expand Up @@ -318,6 +328,16 @@ public function setEmbeds(array $embeds): self
return $this->addEmbed(...$embeds);
}

/**
* Returns all the embeds in the builder.
*
* @return array[]|null
*/
public function getEmbeds(): ?array
{
return $this->embeds;
}

/**
* Sets the allowed mentions object of the message.
*
Expand Down Expand Up @@ -750,14 +770,6 @@ public function jsonSerialize(): ?array
$body['poll'] = $this->poll;
}

if (isset($this->enforce_nonce)) {
$body['enforce_nonce'] = $this->enforce_nonce;
}

if (isset($this->poll)) {
$body['poll'] = $this->poll;
}

return $body;
}
}