public function handleIRCMessage(IRCMessage $msg) {
$this->last_contact = time();
- if ($msg->isPrivMsg()) {
- $this->handlePrivMsg($msg);
- return;
- }
if ($msg->isPing()) {
$this->sendIRCMessage($msg->makePong());
return;
if ($msg->isPong()) {
return;
}
+ $msg->log();
+ if ($msg->isPrivMsg()) {
+ $this->handlePrivMsg($msg);
+ return;
+ }
if ($msg->isNotice() && $msg->getText() == 'Login authentication failed') {
$this->logger->notice('login failed, refreshing access token');
$this->token->refresh();
public function handlePrivMsg(IRCMessage $msg) {
$target = $msg->getPrivMsgTarget();
- if ($target[0] != '#') return;
+ if ($target[0] != '#') return; // direct message
$text = $msg->getText();
if ($text[0] != '!') return;
$channel = Channel::firstWhere('twitch_chat', '=', $target);