static bool TextToResp(string src, Chat CurChat) { string key = DB.SearchKey(src); string[] COMMANDS = { "exit", "block", "reset", "shutdown" }; bool command = false; foreach (string s in COMMANDS) { if (!command) { command = s == key; } } if (!command || CurChat.mode != 0) { if (key.Contains("mode") && key.Contains("to")) { CurChat.ChangeMode(key[2] - '0'); return(true); } else if (CurChat.mode == 0) { if (key == "чтосказать" && !CurChat.IsPrivate()) { key = "idk"; } Say(Answering(key, CurChat), CurChat); //!!!!!!!!!!!! if (key == "чтосказать") { CurChat.AddNew = src; } DB.SaveChat(CurChat, false); return(true); } } else { SpecCommands(key, CurChat); return(true); } return(false); }
static void CommandAnalyse(string src, Chat CurChat, DateTime DT) { if (src.Length < 1 || src[0] != '/') { return; } src = StringChanger.ToLower(src); int x = src.IndexOf("@"); if (x > 0 && src.IndexOf(name) < 0) { return; } else if (x > 0) { src = src.Substring(0, x); } if (src == "/start") { Say(Answering("приветствие"), CurChat); } else if (src == "/reset") { SpecCommands("reset", CurChat); } else if (src == "/show") { SpecCommands("show", CurChat); } else if (src == "/exit") { SpecCommands("exit", CurChat); } else if (src == "/block") { SpecCommands("block", CurChat); } else if (src == "/full") { SpecCommands("full", CurChat); } else if (src == "/help") { Say(DB.Help(), CurChat); } else if (src == "/talk") { CurChat.ChangeMode(0); } else if (src == "/photo") { CurChat.ChangeMode(1); } else if (src == "/song") { CurChat.ChangeMode(2); } else if (src == "/poet") { CurChat.ChangeMode(3); } else if (src == "/ping") { Say(Pong(DT), CurChat); } else if (src == "/next" && CurChat.mode == 1) { SendPhoto(CurChat); } else if (src == "/next" && CurChat.mode == 3) { SayRhymes(CurChat); } else if (src == "/stat") { Say(Answering(CurChat.mode + "mode"), CurChat); } DB.SaveChat(CurChat, false); }