Exemple #1
0
        public List <string> RunCommand(ChannelMessageEventDataModel messageEvent, GroupCollection arguments = null, bool useCache = true)
        {
            Uri matchedUri    = new Uri(arguments[0].Value);
            var mentionConfig = UrlHistory.GetConfig();
            var mention       =
                UrlHistory.GetUrlMention(mentionConfig, messageEvent.Channel, matchedUri.AbsoluteUri);

            if (mention == null)
            {
                UrlHistory.AddUrlMention(messageEvent.Nick, messageEvent.Channel, matchedUri.AbsoluteUri);
                return(null);
            }

            if (!UrlHistory.IsChannelEnabled(messageEvent.Channel))
            {
                return(null);
            }

            if (String.Equals(mention.User, messageEvent.Nick, UrlHistory.ComparisonCulture))
            {
                return(null);
            }

            return(UrlHistory.FormatResponse(mention, messageEvent.Nick,
                                             UrlHistory.GetResponse(mentionConfig, messageEvent.Channel),
                                             preventHighlight: UrlHistory.ShouldPreventNickHighlight(mention.User)).SplitInParts(430).ToList());
        }
 public void RunCommand(IrcClient client, GroupCollection values, IrcEventArgs eventArgs, IrcBot ircBot)
 {
     Cache.Set(UrlHistory.CacheName, UrlHistory.GetConfig(false), DateTimeOffset.Now.AddMinutes(UrlHistory.CacheExpiration));
     client.SendMessage(SendType.Message, eventArgs.Data.Channel, "Reloaded URL mention config and saved to cache");
 }