public void MessageReceived(Update u) { // Check if present if (!memory.ContainsMeme(u.Message.From.ID.ToString())) { Meme mBase = new Brain.Meme() { Class = "user", Subject = u.Message.From.ID.ToString() }; Meme mName = new Brain.Meme() { Class = "name", Subject = u.Message.From.FirstName }; mBase.Relations.Add(mName.Subject, mName); memory.InsertMeme(mBase); return; } Meme personBase = memory.GetMeme(u.Message.From.ID.ToString()); var textMeaning = memory.AnalyseSentence(u.Message.Text); Task result = null; if (textMeaning.Contains("greet")) { result = this.SendMessageAsync(new MessageToSend() { ChatID = u.Message.From.ID.ToString(), Text = "Mauw..." + u.Message.From.FirstName, ParseMode = "HTML" }); } else if (textMeaning.Contains("doing")) { if (!personBase.Relations.ContainsKey("chill")) { var stream = File.OpenRead("chillinabox.jpg"); result = SendPhotoAsync(new PhotoToSend() { ChatID = u.Message.From.ID.ToString(), PhotoStream = stream, PhotoName = "chillinabox.jpg", Caption = "Not much chilling in a box" }); personBase.Relations.Add("chill", new Meme() { Subject = "chill" }); } else { result = RandomAnswer(u); } } else if (textMeaning.Contains("eat")) { if (!personBase.Relations.ContainsKey("fridge")) { var stream = File.OpenRead("kingofthefridge.jpg"); result = SendPhotoAsync(new PhotoToSend() { ChatID = u.Message.From.ID.ToString(), PhotoStream = stream, PhotoName = "kingofthefridge.jpg", Caption = "Whoe ha! all ready on it.. the fridge" }); personBase.Relations.Add("fridge", new Meme() { Subject = "fridge" }); } else if (!personBase.Relations.ContainsKey("otoro")) { result = this.SendMessageAsync(new MessageToSend() { ChatID = u.Message.From.ID.ToString(), Text = "Aw yessss... o toro )><(((('> plz", ParseMode = "HTML" }); personBase.Relations.Add("otoro", new Meme() { Subject = "otoro" }); } else { result = this.SendMessageAsync(new MessageToSend() { ChatID = u.Message.From.ID.ToString(), Text = "NOM nom NOM nom NOM nom NOM nom", ParseMode = "HTML" }); } } else { result = RandomAnswer(u); } result.Wait(); }