All pastes #205334 Raw Edit

staulkor

public text v1 · immutable
#205334 ·published 2006-10-16 18:54 UTC
rendered paste body
else if (e.Data.Message.StartsWith("!google"))
            {
                Google.GoogleSearchService s = new Google.GoogleSearchService();
                try
                {
                    Google.GoogleSearchResult r = s.doGoogleSearch(key, e.Data.Message.Substring(7), 0, 1, false, "", false, "", "", "");
                    string message = r.resultElements[0].title + " // " + r.resultElements[0].snippet;
                    string pattern = @"<(.|\n)*?>";
                    string stripped = Regex.Replace(message, pattern, string.Empty) + " <END OF GOOGLE>";
                    irc.SendMessage(SendType.Message, e.Data.Channel, stripped);
                    OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> " + stripped + "\r\n");
                }
                catch (System.Web.Services.Protocols.SoapException ex)
                {
                    OutputLine(ex.Message);
                }
            }