public async Task DealMessage(string groupNo, string account) { try { var key = CacheConst.GetGroupMsgListKey(groupNo); string cacheMsgInfo = await _database.ListLeftPopAsync(key); IMahuaApi mahuaApi = null; while (!string.IsNullOrWhiteSpace(cacheMsgInfo)) { mahuaApi = mahuaApi ?? MahuaRobotManager.Instance.CreateSession(account).MahuaApi; GroupItemRes msg = JsonConvert.DeserializeObject <GroupItemRes>(cacheMsgInfo); MahuaApiHelper.SendGroupMsg(mahuaApi, msg, groupNo, account); cacheMsgInfo = await _database.ListLeftPopAsync(key); } } catch (Exception e) { var str = e.Message; } }
public static void SendGroupMsg(IMahuaApi mahuaApi, GroupItemRes item, string group, string account) { var msg = mahuaApi.SendGroupMessage(group); if (item.AtAll) { msg.AtlAll().Text(item.Msg).Done(); } else if (item.AtTa) { msg.At(account).Text(item.Msg).Done(); } else { msg.Text(item.Msg).Done(); } }