diff --git a/app/Bots/IRCAnnounceBot.php b/app/Bots/IRCAnnounceBot.php index af5cc0a90..99f819827 100644 --- a/app/Bots/IRCAnnounceBot.php +++ b/app/Bots/IRCAnnounceBot.php @@ -117,10 +117,11 @@ class IRCAnnounceBot public function to(string $recipient): self { $this->recipient = $recipient; + $channelKey = config('irc-bot.channel_key', ''); if (config('irc-bot.joinchannel')) { if ($this->isValidChannelName($recipient)) { - $this->join($recipient); + $this->join($recipient, $channelKey); $this->isInChannel = true; } else { Log::error('Tried to channel with invalid name.', [ @@ -192,7 +193,7 @@ class IRCAnnounceBot /** * @see https://www.rfc-editor.org/rfc/rfc1459#section-4.2.1 */ - private function join(string $channel, string $key = ''): void + private function join(string $channel, string $channelKey = ''): void { if (!$this->isValidChannelName($channel)) { Log::error('Tried to join a channel with invalid name.', ['name' => $channel]); @@ -200,7 +201,7 @@ class IRCAnnounceBot return; } - $this->send("JOIN {$channel} {$key}"); + $this->send("JOIN {$channel} {$channelKey}"); } /** diff --git a/config/irc-bot.php b/config/irc-bot.php index 982146e62..c94857029 100644 --- a/config/irc-bot.php +++ b/config/irc-bot.php @@ -30,6 +30,7 @@ return [ 'username' => 'UNIT3D', 'password' => 'UNIT3D', 'channel' => '#announce', + 'channel_key' => 'UNIT3D', 'nickservpass' => false, 'joinchannel' => false, ];