/// <summary> /// Type=21 私聊消息。 /// </summary> /// <param name="subType">子类型,11/来自好友 1/来自在线状态 2/来自群 3/来自讨论组。</param> /// <param name="sendTime">发送时间(时间戳)。</param> /// <param name="fromQQ">来源QQ。</param> /// <param name="msg">消息内容。</param> /// <param name="font">字体。</param> public override void PrivateMessage(int subType, int sendTime, long fromQQ, string msg, int font) { if (fromQQ != LoginQQ) { try { string result = String.Format(DiceService.Received(fromQQ, msg)); if (result != null) { CQ.SendPrivateMessage(fromQQ, result); } } catch (Exception ex) { Debug.Print(ex.Message); } } }
/// <summary> /// Type=2 群消息。 /// </summary> /// <param name="subType">子类型,目前固定为1。</param> /// <param name="sendTime">发送时间(时间戳)。</param> /// <param name="fromGroup">来源群号。</param> /// <param name="fromQQ">来源QQ。</param> /// <param name="fromAnonymous">来源匿名者。</param> /// <param name="msg">消息内容。</param> /// <param name="font">字体。</param> public override void GroupMessage(int subType, int sendTime, long fromGroup, long fromQQ, string fromAnonymous, string msg, int font) { if (fromQQ != LoginQQ) { try { string result = String.Format(DiceService.ReceivedGroupMessage(fromQQ, fromGroup, msg)); if (result != null) { if (msg.ToLower().Contains(".rs")) {//暗骰只发送给投掷者与OB玩家 CQ.SendGroupMessage(fromGroup, "投掷暗骰,结果已隐藏。"); CQ.SendPrivateMessage(fromQQ, result); if (DiceService.OBGroupMap.TryGetValue(fromGroup, out List <long> list) && list.Count > 0) { foreach (long qq in list) { if (qq != fromQQ) { CQ.SendPrivateMessage(qq, result); } } } } else { CQ.SendGroupMessage(fromGroup, result); } } } catch (Exception ex) { Debug.Print(ex.Message); } } }