Skip to content

Commit

Permalink
Update EntitlementDelete.php
Browse files Browse the repository at this point in the history
since it is linked, things should be easier
  • Loading branch information
key2peace authored Oct 20, 2023
1 parent a856129 commit ff95829
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/Discord/WebSockets/Events/EntitlementDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,7 @@ class EntitlementDelete extends Event
*/
public function handle($data)
{
$entitlementPart = null;

/** @var ?\Discord\Parts\Interaction\Entitlement */
if ($entitlementPart = yield $this->discord->application->entitlements->pull($data->id)) {
/** @var User */
if ($entitlementPart->user_id && $user = $this->discord->users->get('id', $entitlementPart->user_id)) {
$user->entitlements->unset($data->id);
}

/** @var Guild */
if ($entitlementPart->guild_id && $guild = $this->discord->guilds->get('id', $entitlementPart->guild_id)) {
$guild->entitlements->unset($data->id);
}

if ($entitlementPart = $this->discord->application->entitlements->pull($data->id)) {
$entitlementPart->fill((array) $data);
$entitlementPart->created = false;
}
Expand Down

0 comments on commit ff95829

Please sign in to comment.