浏览代码

Correctly log cases where getMessageIntent returns nil

Tulir Asokan 4 年之前
父节点
当前提交
83779c6970
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      portal.go

+ 7 - 2
portal.go

@@ -347,9 +347,14 @@ func (portal *Portal) startHandling(source *User, info whatsapp.MessageInfo) *ap
 	} else if portal.isDuplicate(info.Id) {
 	} else if portal.isDuplicate(info.Id) {
 		portal.log.Debugfln("Not handling %s: message is duplicate", info.Id)
 		portal.log.Debugfln("Not handling %s: message is duplicate", info.Id)
 	} else {
 	} else {
-		portal.log.Debugfln("Starting handling of %s (ts: %d)", info.Id, info.Timestamp)
 		portal.lastMessageTs = info.Timestamp
 		portal.lastMessageTs = info.Timestamp
-		return portal.getMessageIntent(source, info)
+		intent := portal.getMessageIntent(source, info)
+		if intent != nil {
+			portal.log.Debugfln("Starting handling of %s (ts: %d)", info.Id, info.Timestamp)
+		} else {
+			portal.log.Debugfln("Not handling %s: sender is not known")
+		}
+		return intent
 	}
 	}
 	return nil
 	return nil
 }
 }