]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBot/TwitchBot.php
tentative implementation of ZSR sync
[alttp.git] / app / TwitchBot / TwitchBot.php
index bb3724d6844bbf7f0990f5306fb3f04069f834a3..63f4236f685e92bf659610257e93177a78cf7a11 100644 (file)
@@ -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) {
                        }
                });