]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBot/IRCMessage.php
update muffins tracker
[alttp.git] / app / TwitchBot / IRCMessage.php
index 0f73c06797a79b4694215dbe09a380392e56620f..35ac2783910f5f5a5c0bd0d6c3e85eaed94a4a78 100644 (file)
@@ -93,6 +93,7 @@ class IRCMessage {
                                } else {
                                        $str .= ';';
                                }
+                               // TODO: this may need some kind of encoding?
                                $str .= $name.'=';
                                if (!empty($value)) {
                                        $str .= $value;
@@ -140,6 +141,13 @@ class IRCMessage {
                return TokenizedMessage::fromIRC($this);
        }
 
+       public static function capReq($cap) {
+               $msg = new IRCMessage();
+               $msg->command = 'CAP REQ';
+               $msg->params[] = $cap;
+               return $msg;
+       }
+
        public static function join($channels) {
                $msg = new IRCMessage();
                $msg->command = 'JOIN';
@@ -199,6 +207,14 @@ class IRCMessage {
                return $this->command == 'PRIVMSG';
        }
 
+       public function isRoomstate() {
+               return $this->command == 'ROOMSTATE';
+       }
+
+       public function isWhisper() {
+               return $this->command == 'WHISPER';
+       }
+
        public function isOwner() {
                return substr($this->getPrivMsgTarget(), 1) == $this->nick;
        }
@@ -207,6 +223,14 @@ class IRCMessage {
                return $this->isOwner() || (isset($this->tags['mod']) && $this->tags['mod'] == '1');
        }
 
+       public function hasTag($name) {
+               return array_key_exists($name, $this->tags);
+       }
+
+       public function getTag($name) {
+               return $this->tags[$name];
+       }
+
        public function makePong() {
                $msg = new IRCMessage();
                $msg->command = 'PONG';