static void Room_Client_MessageReceived(LiveCodingChat.Xmpp.Room room, LiveCodingChat.Xmpp.MessageReceivedEventArgs e) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(e.Nick + ": " + e.Message); Console.ForegroundColor = ConsoleColor.White; if (e.User == null) return; string fnd = e.Message.ToLower(); System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("NE[E]*I[I]*N TO[O]*M NE[E]*I[I]*N"); if (fnd.Contains("@tom") || fnd.Contains("@bobstriker") || r.IsMatch(fnd.ToUpper())) { if (player == null) System.Media.SystemSounds.Exclamation.Play(); else player.Play(); } if (e.User.ID == session.Username) return; if (fnd.Contains(session.Username) || fnd.Contains("adam")) { room.SendMessage("@" + e.Nick + ": Hier wird OctoAwesome entwickelt. Mehr Infos unter http://www.octoawesome.net"); } }
static void Room_Client_MessageReceived(LiveCodingChat.Xmpp.Room room, LiveCodingChat.Xmpp.MessageReceivedEventArgs e) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(e.Nick + ": " + e.Message); Console.ForegroundColor = ConsoleColor.White; if (!isStarted) return; if (e.User == null) return; string fnd = e.Message.ToLower(); System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("NE[E]*I[I]*N TO[O]*M NE[E]*I[I]*N"); if (fnd.Contains("@tom") || fnd.Contains("@bobstriker") || r.IsMatch(fnd.ToUpper())) { if (player == null) System.Media.SystemSounds.Exclamation.Play(); else player.Play(); } if (e.User.ID == chatRoom.Client.Nick || e.User.ID == "octobot")//TODO email->nick/username return; if (fnd.Contains(chatRoom.Client.Nick) || fnd.Contains("adam")) { room.SendMessage("@" + e.Nick + ": Hier wird OctoAwesome entwickelt. Mehr Infos unter http://www.octoawesome.net"); } if (e.Nick == "jvbsl" || e.User.Staff || e.User.Role == "moderator") { if (fnd.StartsWith("/strawpoll ")) { string[] args = e.Message.Substring("/strawpoll ".Length).Split(','); Strawpoll poll = new Strawpoll(args); string pollRes = poll.CreatePoll(); if (pollRes != null) room.SendMessage("Neuer Poll - " + args[0] + ": " + pollRes); } } if (fnd.Contains("kopfoderzahl?")) { byte b = Convert.ToByte(rnd.Next(0, 2)); switch (b) { case 0: room.SendMessage("@" + e.Nick + " Kopf"); break; case 1: room.SendMessage("@" + e.Nick + " Zahl"); break; } } }