Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit a538d25

Browse files
committed
Fixed replying with Embed objects
1 parent 12838c2 commit a538d25

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Discord/Parts/Interaction.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Discord\Discord;
1515
use Discord\Http\Http;
1616
use Discord\InteractionResponseType;
17+
use Discord\Parts\Embed\Embed;
1718
use React\Promise\ExtendedPromiseInterface;
1819
use Symfony\Component\OptionsResolver\OptionsResolver;
1920

@@ -112,7 +113,7 @@ public function acknowledge(?bool $source = true)
112113
($this->resolve)([
113114
'type' => InteractionResponseType::DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE,
114115
]);
115-
116+
116117
}
117118

118119
/**
@@ -128,8 +129,16 @@ public function acknowledge(?bool $source = true)
128129
* Source is unused
129130
* @see https://discord.com/developers/docs/change-log#changes-to-slash-command-response-types-and-flags
130131
*/
131-
public function reply(string $content, bool $tts = false, ?array $embeds = null, ?array $allowed_mentions = null, ?bool $source = false)
132+
public function reply(string $content, bool $tts = false, array $embeds = [], ?array $allowed_mentions = null, bool $source = false)
132133
{
134+
$embeds = array_map(function ($e) {
135+
if ($e instanceof Embed) {
136+
return $e->getRawAttributes();
137+
}
138+
139+
return $e;
140+
}, $embeds);
141+
133142
$response = [
134143
'content' => $content,
135144
'tts' => $tts,

0 commit comments

Comments
 (0)