X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FTwitchBot.php;h=63f4236f685e92bf659610257e93177a78cf7a11;hb=1b9629ce7f600b4aa9c9d51a281e514031871828;hp=bb3724d6844bbf7f0990f5306fb3f04069f834a3;hpb=06fbdc15c8db57590c9b6a38ee1f00d5f349cff9;p=alttp.git diff --git a/app/TwitchBot/TwitchBot.php b/app/TwitchBot/TwitchBot.php index bb3724d..63f4236 100644 --- a/app/TwitchBot/TwitchBot.php +++ b/app/TwitchBot/TwitchBot.php @@ -23,6 +23,9 @@ class TwitchBot { if (!$this->token) { throw new \Exception('unable to find access token'); } + if ($this->token->hasExpired()) { + $this->token->refresh(); + } $this->connector = new Connector(); $this->connect(); @@ -156,7 +159,7 @@ class TwitchBot { if (!$this->ready) return; if (time() - $this->last_contact < 60) return; try { - $this->sendIRCMessage(IRCMessage::ping()); + $this->sendIRCMessage(IRCMessage::ping($this->nick)); } catch (\Exception $e) { } });