public override void MsgRecived(object sender, RecvMessageEvent e) { if (e.Msg.Content.Contains("#SendAll")) { SendAll(e.Msg.Content.Substring(8)); } }
public void MessageRecived(object sender, RecvMessageEvent e) { if (!init) { if (notInitExceptionCount++ > 5) { Log("小冰插件未加载成功"); notInitExceptionCount = 0; } return; } if (e.Msg.FromUserName == xiaobinId) { SendMsgToUser(e); } else { if (e.Msg.FromUserName.Contains("@@")) { //Console.WriteLine(""); return; } //屏蔽群消息 SendMsgToXiaobin(e); } }
private void SendMsgToXiaobin(RecvMessageEvent e) { if (e.Msg.MsgType != 1) { return; } lastUserName.Enqueue(e.Msg.FromUserName); wxServices.SendMsg(xiaobinId, e.Msg.Content); }
private void SendMsgToUser(RecvMessageEvent e) { if (lastUserName.Count == 0) { if (noUserRemainExceptionCount++ > 5) { Log("已无用户可回复"); noUserRemainExceptionCount = 0; } return; } string user = lastUserName.Dequeue(); if (e.Msg.MsgType != 1) { wxServices.SendMsg(user, "[小冰自动回复]收到其他类型的消息" + e.Msg.MsgType); } else { wxServices.SendMsg(user, "[小冰自动回复]" + e.Msg.Content); } }