Exemplo n.º 1
0
        static void TheRussia(BotMessageContext ctx, string data)
        {
            var chan  = ctx.IRC.Channels[ctx.Msg.Source];
            var regex = new Regex(@"\brussia(?:|ns?)\b", RegexOptions.IgnoreCase);

            if (regex.Match(data).Success)
            {
                ctx.IRC.SendMessage($"{Fmt.Colorize(Fmt.Colors.Red)}Russia!{Fmt.Reset}", chan.Name);
            }
        }
Exemplo n.º 2
0
        static void HtmlTitles(BotMessageContext ctx, string data)
        {
            var chan    = ctx.IRC.Channels[ctx.Msg.Source];
            var matches = new Regex(@"\b(https?://\S+)\b").Matches(data); // (?:\b|['""])

            foreach (Match match in matches)
            {
                var url = match.Groups[1].Value;
                Utils.GetHtmlTitleAsync(url,
                                        v => ctx.IRC.SendMessage($"Found URL: {Fmt.Colorize(Fmt.Colors.Green)}{v}{Fmt.Reset}", chan.Name));
            }
        }