private void ProcAnsMessages() { long lastCheckAA = 0; if (phTargetsAA.Count == 0) { Log.Push($"[{login}]: Обработка автоответа в лички и чаты..."); ExecuteManager executeManager = new ExecuteManager(token); foreach (Message current in msgs) { if (current.date >= lastCheckAA) { foreach (PhrasesTargetAA current2 in phTargetsAA) { if (current2.id == current.user_id && current.chat_id == null) { executeManager.Add(string.Concat(new string[] { "API.messages.send({\"user_id\":", current2.id, ",\"message\":\"", current2.name.Replace("\"", "\\\""), MainForm.phrases[rnd.Next(0, MainForm.phrases.Length)].Replace("\"", "\\\""), "\"});" })); break; } bool auto = current2.id.Substring(1) == current.chat_id && new List <string>(current2.name.Split(new char[] { ',' })).Contains(current.user_id); if (auto) { executeManager.Add(string.Concat(new object[] { "API.messages.send({\"chat_id\":", current2.id.Substring(1), ",\"message\":\"", MainForm.phrases[rnd.Next(0, MainForm.phrases.Length)].Replace("\"", "\\\""), "\", \"forward_messages\":\"", current.id, "\"});" })); break; } } } } executeManager.Execute(); } }
private void ProcAnsEverythingWithPics() { if (picTargetsAA.Count == 0) { Log.Push($"[{login}]: Обработка автоответа картинками..."); ExecuteManager executeManager = new ExecuteManager(token); foreach (Message current in msgs) { if (current.read_state == 0) { if (current.chat_id == null) { using (List <string> .Enumerator enumerator2 = pictReplyPM.GetEnumerator()) { while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; if (current2 == current.user_id) { executeManager.Add(string.Concat(new string[] { "API.messages.send({\"user_id\":", current2, ", \"attachment\":\"", GetRandomPhoto(), "\"});" })); break; } } continue; } } foreach (string current3 in pictReplyChats) { if (current3 == current.chat_id) { executeManager.Add(string.Concat(new string[] { "API.messages.send({\"chat_id\":", current3, ", \"attachment\":\"", GetRandomPhoto(), "\"});" })); break; } } } } } }
private void ProcChats() { if (chTargets.Count == 0) { Log.Push($"[{login}]: Обработка чатов..."); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); string text = ""; foreach (ChatsTarget current in chTargets) { text = text + current.chatID + ","; } text = text.Substring(0, text.Length - 1); string text2 = StrWrk.qSubstr(VKserver.APIRequest("messages.getChat", "chat_ids=" + text, token, ""), "\"response\":", false); text2 = text2.Substring(0, text2.Length - 1); List <ChatInfo> .Enumerator enumerator2 = javaScriptSerializer.Deserialize <List <ChatInfo> >(text2).GetEnumerator(); List <ChatsTarget> .Enumerator enumerator3 = chTargets.GetEnumerator(); ExecuteManager executeManager = new ExecuteManager(token); while (enumerator2.MoveNext() && enumerator3.MoveNext()) { if (enumerator3.Current.setPhoto == "Удалять" && enumerator2.Current.photo_50 != null) { executeManager.Add("API.messages.deleteChatPhoto({\"chat_id\":" + enumerator3.Current.chatID + "});"); } if (enumerator3.Current.setPhoto != "" && enumerator3.Current.setPhoto != "Удалять" && enumerator3.Current.setPhoto != "Ничего" && (floodPicsCH || enumerator2.Current.photo_50 != enumerator3.Current.ourPic50)) { string text3 = StrWrk.qSubstr(VKserver.APIRequest("messages.setChatPhoto", "file=" + enumerator3.Current.uploadedPhoto, token, ""), "\"response\":", false); text3 = text3.Substring(0, text3.Length - 1); text3 = StrWrk.qSubstr(text3, "\"chat\":", false); text3 = text3.Substring(0, text3.Length - 1); ChatInfo chatInfo = javaScriptSerializer.Deserialize <ChatInfo>(text3); enumerator3.Current.ourPic50 = chatInfo.photo_50; } if (enumerator3.Current.capChangeTo != "" && enumerator3.Current.capChangeTo != enumerator2.Current.title) { executeManager.Add(string.Concat(new string[] { "API.messages.editChat({\"chat_id\":", enumerator3.Current.chatID, ", \"title\":\"", enumerator3.Current.capChangeTo.Replace("\"", "\\\""), "\"});" })); } } executeManager.Execute(); } }