X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FTwitchBot%2FIRCMessage.php;h=d127f9f5d57425e850512640d6ae470c2f0c1bc3;hb=31127000e16c18389129546b9aa652de565683fb;hp=c0acfbb547cc2d205fff7ef5420fdfbe07ce9ad1;hpb=898d01d4ac5ccaa23621abda0761a893ff8c1074;p=alttp.git diff --git a/app/TwitchBot/IRCMessage.php b/app/TwitchBot/IRCMessage.php index c0acfbb..d127f9f 100644 --- a/app/TwitchBot/IRCMessage.php +++ b/app/TwitchBot/IRCMessage.php @@ -132,6 +132,28 @@ class IRCMessage { return $msg; } + public static function part($channels) { + $msg = new IRCMessage(); + $msg->command = 'PART'; + $msg->params[] = implode(',', $channels); + return $msg; + } + + public static function ping($token = 'localhorsttv') { + $msg = new IRCMessage(); + $msg->command = 'PING'; + $msg->params[] = $token; + return $msg; + } + + public static function privmsg($target, $message) { + $msg = new IRCMessage(); + $msg->command = 'PRIVMSG'; + $msg->params[] = $target; + $msg->params[] = $message; + return $msg; + } + public function getPrivMsgTarget() { if (!empty($this->params)) { return $this->params[0]; @@ -154,6 +176,10 @@ class IRCMessage { return $this->command == 'PING'; } + public function isPong() { + return $this->command == 'PONG'; + } + public function isPrivMsg() { return $this->command == 'PRIVMSG'; }