From 6dddcc702b9cbc4572041b20d7c3db395afe8e68 Mon Sep 17 00:00:00 2001 From: Valithor Obsidion Date: Sun, 29 Sep 2024 07:28:41 -0400 Subject: [PATCH] Whoops --- .../WebSockets/Events/SubscriptionCreate.php | 13 ++++--- .../WebSockets/Events/SubscriptionDelete.php | 10 +++--- .../WebSockets/Events/SubscriptionUpdate.php | 35 +++++++------------ 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/Discord/WebSockets/Events/SubscriptionCreate.php b/src/Discord/WebSockets/Events/SubscriptionCreate.php index aefcc0f66..e80cef2da 100644 --- a/src/Discord/WebSockets/Events/SubscriptionCreate.php +++ b/src/Discord/WebSockets/Events/SubscriptionCreate.php @@ -11,8 +11,7 @@ namespace Discord\WebSockets\Events; -use Discord\Parts\Guild\Guild; -use Discord\Parts\Entitlements\SKU; +use Discord\Parts\Entitlements\Subscription; use Discord\WebSockets\Event; /** @@ -20,18 +19,18 @@ * * @since 10.0.0 */ -class SKUCreate extends Event +class SubscriptionCreate extends Event { /** * {@inheritDoc} */ public function handle($data) { - /** @var SKU */ - $SKUPart = $this->factory->part(SKU::class, (array) $data, true); + /** @var Subscription */ + $subscriptionPart = $this->factory->part(Subscription::class, (array) $data, true); - $this->discord->skus->set($data->id, $SKUPart); + $this->discord->subscriptions->set($data->id, $subscriptionPart); - return $SKUPart; + return $subscriptionPart; } } diff --git a/src/Discord/WebSockets/Events/SubscriptionDelete.php b/src/Discord/WebSockets/Events/SubscriptionDelete.php index d0eef05d7..032856f5c 100644 --- a/src/Discord/WebSockets/Events/SubscriptionDelete.php +++ b/src/Discord/WebSockets/Events/SubscriptionDelete.php @@ -11,7 +11,7 @@ namespace Discord\WebSockets\Events; -use Discord\Parts\Entitlements\SKU; +use Discord\Parts\Entitlements\Subscription; use Discord\WebSockets\Event; /** @@ -19,16 +19,16 @@ * * @since 10.0.0 */ -class SKUDelete extends Event +class SubscriptionDelete extends Event { /** * {@inheritDoc} */ public function handle($data) { - /** @var ?SKU */ - $SKUPart = yield $this->discord->skus->cachePull($data->id); + /** @var ?Subscription */ + $subscriptionPart = yield $this->discord->subscriptions->cachePull($data->id); - return $SKUPart ?? $this->factory->part(SKU::class, (array) $data); + return $subscriptionPart ?? $this->factory->part(Subscription::class, (array) $data); } } diff --git a/src/Discord/WebSockets/Events/SubscriptionUpdate.php b/src/Discord/WebSockets/Events/SubscriptionUpdate.php index 76311b745..213d7f301 100644 --- a/src/Discord/WebSockets/Events/SubscriptionUpdate.php +++ b/src/Discord/WebSockets/Events/SubscriptionUpdate.php @@ -11,44 +11,35 @@ namespace Discord\WebSockets\Events; -use Discord\Parts\Guild\Guild; -use Discord\Parts\Entitlements\SKU; +use Discord\Parts\Entitlements\Subscription; use Discord\WebSockets\Event; /** - * @link https://discord.com/developers/docs/topics/gateway-events#guild-SKUboard-SKU-update + * @link https://discord.com/developers/docs/topics/gateway-events#guild-Subscriptionboard-Subscription-update * * @since 10.0.0 */ -class SKUUpdate extends Event +class SubscriptionUpdate extends Event { /** * {@inheritDoc} */ public function handle($data) { - $newSKUPart = $oldSKUPart = null; + $newSubscriptionPart = $oldSubscriptionPart = null; - /** @var ?SKU */ - $oldSKUPart = yield $this->discord->skus->cacheGet($data->id); - if ($oldSKUPart instanceof SKU) { - $newSKUPart = clone $oldSKUPart; - $newSKUPart->fill((array) $data); + /** @var ?Subscription */ + $oldSubscriptionPart = yield $this->discord->Subscriptions->cacheGet($data->id); + if ($oldSubscriptionPart instanceof Subscription) { + $newSubscriptionPart = clone $oldSubscriptionPart; + $newSubscriptionPart->fill((array) $data); } - /** @var SKU */ - $newSKUPart = $newSKUPart ?? $this->factory->part(SKU::class, (array) $data, true); + /** @var Subscription */ + $newSubscriptionPart = $newSubscriptionPart ?? $this->factory->part(Subscription::class, (array) $data, true); - $this->discord->skus->set($data->id, $newSKUPart); + $this->discord->Subscriptions->set($data->id, $newSubscriptionPart); - return [$newSKUPart, $oldSKUPart]; + return [$newSubscriptionPart, $oldSubscriptionPart]; } } - - - - - - - -