Example #1
0
func (s *Service) GroupAI(grpmsg *interfaces.GroupMsg, pstman interfaces.Postman) {
	var matchHandle Handle
	var result string
	for _, handle := range s.Handles {
		if isMatchHandle(grpmsg.Msg, handle.KeyWords()) {
			matchHandle = handle
		}
	}
	if matchHandle != nil {
		result = matchHandle.GroupThinkOut(s, grpmsg.Msg)
	} else {
		result = "对不起我暂时有点笨,现在只能理解索要联系方式和设置提醒"
	}
	fmt.Println("group id ", grpmsg.GroupId)
	pstman.SendGroupMsg(grpmsg.GroupId, result)
	return
}
Example #2
0
func (s *Service) AI(msg *interfaces.Msg, pstman interfaces.Postman) {
	var matchHandle Handle
	var result string
	for _, handle := range s.Handles {
		if isMatchHandle(msg.Msg, handle.KeyWords()) {
			matchHandle = handle
			fmt.Println("match handle", handle.KeyWords())
		}
	}
	if matchHandle != nil {
		result = matchHandle.ThinkOut(s, msg.Msg)
	} else {
		result = "对不起我暂时有点笨,现在只能理解索要联系方式和设置提醒"
	}
	pstman.SendMsg(msg.From, result)
	return
}