From 43c1877856b32386ba6eb02bc4a844ce70bd2457 Mon Sep 17 00:00:00 2001 From: SQKo <87897282+SQKo@users.noreply.github.com> Date: Thu, 31 Mar 2022 10:29:16 +0700 Subject: [PATCH] fix message channel error --- src/Discord/Discord.php | 2 +- src/Discord/Parts/Channel/Message.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Discord/Discord.php b/src/Discord/Discord.php index 41b550ae7..b5fa68aad 100644 --- a/src/Discord/Discord.php +++ b/src/Discord/Discord.php @@ -86,7 +86,7 @@ class Discord * * @var string Version. */ - public const VERSION = 'v7.0.7'; + public const VERSION = 'v7.0.8'; /** * The logger. diff --git a/src/Discord/Parts/Channel/Message.php b/src/Discord/Parts/Channel/Message.php index a0bce3511..86f47d91c 100644 --- a/src/Discord/Parts/Channel/Message.php +++ b/src/Discord/Parts/Channel/Message.php @@ -363,14 +363,10 @@ protected function getGuildAttribute(): ?Guild return $guild; } - if ($guild = $this->channel->guild) { - return $guild; - } - + // Workaround for Channel::sendMessage() no guild_id if ($this->channel_id) { - // Workaround for Channel::sendMessage() no guild_id return $this->discord->guilds->find(function (Guild $guild) { - return $guild->channels->has($this->channel_id); + return $guild->channels->offsetExists($this->channel_id); }); }