// Radio Bot // Returns radio stations of your favorite type of music. Advanced bot for students that have finished the tutorial. using System; using System.Text.RegularExpressions; namespace ChatBot { class RadioBot : BasicBot { public override string HandleMessage(string message, string user) { MatchCollection matches = getAllRows(); string reply = "I found these stations: "; foreach(Match match in matches) { string row = match.ToString(); if(User.RegexMatch("dc",message)) Console.WriteLine(row); string stationName, city, state, link, genre; ExtractDetails(row, out stationName, out city, out state, out link, out genre); if(state == "Washington") reply += stationName + "(" + genre + ", " + link + "); "; } return reply; } public static MatchCollection getAllRows() { string usLiveRadio = User.WebpageToString("http://www.usliveradio.com/"); usLiveRadio = usLiveRadio.Trim().Replace('\n',' ').Replace('\t',' ').Replace('\r',' '); Regex regex = new Regex("