From 44ced1d644439460d3523a7004be1712646f65dd Mon Sep 17 00:00:00 2001 From: SQKo <87897282+SQKo@users.noreply.github.com> Date: Wed, 17 Aug 2022 23:11:39 +0700 Subject: [PATCH] Modify Event::GUILD_DELETE behavior & build docs --- docs/src/pages/api/03_events/04_guilds.md | 6 +++++- src/Discord/Discord.php | 2 +- src/Discord/WebSockets/Events/GuildDelete.php | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/src/pages/api/03_events/04_guilds.md b/docs/src/pages/api/03_events/04_guilds.md index 772212cd9..ed02c5cea 100644 --- a/docs/src/pages/api/03_events/04_guilds.md +++ b/docs/src/pages/api/03_events/04_guilds.md @@ -36,10 +36,14 @@ Called with a `Guild` object in one of the following situations: 2. The guild is unavailable due to an outage. ```php -$discord->on(Event::GUILD_DELETE, function (?Guild $guild, Discord $discord, bool $unavailable) { +$discord->on(Event::GUILD_DELETE, function ($guild, Discord $discord, bool $unavailable) { // ... if ($unavailable) { // the guild is unavailabe due to an outage + // { + // "id": "" // guild ID + // "unavailable": true + // } } else { // the Bot has been kicked from the guild } diff --git a/src/Discord/Discord.php b/src/Discord/Discord.php index 7950351b4..76fef1c58 100644 --- a/src/Discord/Discord.php +++ b/src/Discord/Discord.php @@ -86,7 +86,7 @@ class Discord * * @var string Version. */ - public const VERSION = 'v7.2.1'; + public const VERSION = 'v7.2.2'; /** * The logger. diff --git a/src/Discord/WebSockets/Events/GuildDelete.php b/src/Discord/WebSockets/Events/GuildDelete.php index 2643cb987..d3e528a9d 100644 --- a/src/Discord/WebSockets/Events/GuildDelete.php +++ b/src/Discord/WebSockets/Events/GuildDelete.php @@ -11,7 +11,6 @@ namespace Discord\WebSockets\Events; -use Discord\Parts\Guild\Guild; use Discord\WebSockets\Event; use Discord\Helpers\Deferred; @@ -25,6 +24,6 @@ class GuildDelete extends Event */ public function handle(Deferred &$deferred, $data): void { - $deferred->resolve([$this->discord->guilds->pull($data->id), $data->unavailable ?? false]); + $deferred->resolve([$this->discord->guilds->pull($data->id) ?? $data, $data->unavailable ?? false]); } }