Skip to content
Open
Changes from 3 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
5 changes: 2 additions & 3 deletions src/Discord/Parts/Channel/Reaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Discord\Parts\Thread\Thread;
use Discord\Parts\User\User;
use React\Promise\PromiseInterface;
use stdClass;
use Symfony\Component\OptionsResolver\OptionsResolver;

use function Discord\normalizePartId;
Expand Down Expand Up @@ -104,8 +103,8 @@ public function fetch(): PromiseInterface
*/
protected function setIdAttribute(string $value): void
{
if (! isset($this->attributes['emoji'])) {
$this->attributes['emoji'] = new stdClass();
if ($this->emoji === null) {
$this->attributes['emoji'] = $this->factory->part(Emoji::class, [], true);
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the reaction has no existing emoji attribute, this initializes an Emoji Part with an empty payload. Because getEmojiAttribute() only injects guild_id via attributePartHelper() when converting non-Emoji data, an already-instantiated Emoji will not get guild_id populated, which can break Emoji behavior that relies on guild context (e.g., Emoji::guild, roles resolution). Consider initializing the Emoji Part with ['guild_id' => $this->guild_id] (or otherwise ensuring guild_id is set) when creating it here.

Suggested change
$this->attributes['emoji'] = $this->factory->part(Emoji::class, [], true);
$this->attributes['emoji'] = $this->factory->part(Emoji::class, ['guild_id' => $this->guild_id], true);

Copilot uses AI. Check for mistakes.
}

$colonDelimiter = explode(':', $value);
Expand Down