当前位置: 首页>>代码示例>>C#>>正文


C# IIrcMessageSource类代码示例

本文整理汇总了C#中IIrcMessageSource的典型用法代码示例。如果您正苦于以下问题:C# IIrcMessageSource类的具体用法?C# IIrcMessageSource怎么用?C# IIrcMessageSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IIrcMessageSource类属于命名空间,在下文中一共展示了IIrcMessageSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: handleURL

        public bool handleURL(string url, IrcClient ctx, CtcpClient ctpcclient = null, IIrcMessageSource source = null )
        {
            var title = GetPageTitle(url).Trim();
            if (!string.IsNullOrWhiteSpace(title))
            {
                if(title.ToLower().Contains("Domainpark - Bitte den Rasen nicht betreten".ToLower()))
                {
                    int roll = random.Next(0, 101);
                    if(roll < 5)
                    {
                        if(ctpcclient != null)
                        {
                            string textMessage = "slaps " + source.Name + " and screamed:";
                            BotDeathmicMessageTarget target = new BotDeathmicMessageTarget();
                            target.Name = Properties.Settings.Default.Channel.ToString();
                            ctpcclient.SendAction(target, textMessage);
                            ctx.LocalUser.SendMessage(Properties.Settings.Default.Channel, "Runter vom Rasen!");
                        }
                    }
                }
                else
                {
                    if(title.ToLower() == "Imgur: The most awesome images on the Internet".ToLower())
                    {

                    }
                    else
                    {
                        ctx.LocalUser.SendMessage(Properties.Settings.Default.Channel, title);
                    }

                }
            }
            return true;
        }
开发者ID:Kolpa,项目名称:DeathmicChatbot,代码行数:35,代码来源:WebSiteHandler.cs

示例2: IrcMessageCommand

 public IrcMessageCommand(
     IrcBot bot, 
     IrcBotUser user,
     IrcClient client, 
     string[] parameters, 
     IIrcMessageTarget target, 
     IIrcMessageSource source
 )
     : base(bot, user, client, parameters, target, source)
 {
 }
开发者ID:koushikajay,项目名称:Alfred,代码行数:11,代码来源:IrcMessageCommand.cs

示例3: ProcessChatCommandHelp

        private void ProcessChatCommandHelp(IrcClient client, IIrcMessageSource source,
            IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
        {
            if (parameters.Count != 0)
                throw new InvalidCommandParametersException(0);

            // List all commands recognized by this bot.
            var replyTarget = GetDefaultReplyTarget(client, source, targets);
            client.LocalUser.SendMessage(replyTarget, "Commands recognized by bot:");
            client.LocalUser.SendMessage(replyTarget, string.Join(", ",
                this.ChatCommandProcessors.Select(kvPair => kvPair.Key)));
        }
开发者ID:txdv,项目名称:ircdotnet,代码行数:12,代码来源:BasicIrcBot.cs

示例4: handleURL

        public bool handleURL(string url, IrcDotNet.IrcClient ctx, CtcpClient ctpcclient = null, IIrcMessageSource source = null)
        {
            var match = _imgurreg.Match(url);

            if (match.Success)
            {
                var id = match.Groups[2].Value;
                url = "http://imgur.com/gallery/" + id;
                website.handleURL(url, ctx, ctpcclient, source);
                return true;
            }
            return false;
        }
开发者ID:Kolpa,项目名称:DeathmicChatbot,代码行数:13,代码来源:Imgur.cs

示例5: Run

        public void Run(IrcClient client, IIrcMessageSource source, IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
        {
            Client = client;
            SourceUser = (IrcUser)source;
            Command = command;
            Parameters = parameters;

            if (targets.Contains(Client.LocalUser) && source != null)
                ReplyTargets = new[] { (IIrcMessageTarget)source };
            else
            {
                ReplyTargets = targets;
            }

            Run();
        }
开发者ID:bremnes,项目名称:IrcBot,代码行数:16,代码来源:BaseChatCommand.cs

示例6: AddUser

 public bool AddUser(string username, Channels ChannelWatch, IIrcMessageTarget target, IIrcMessageSource source, IrcClient ircConnection)
 {
     ModifyingConfig = true;
     bool returnvalue = false;
     IrcChannel findChannel = null;
     foreach (IrcChannel ircChannel in ircConnection.Channels)
     {
         if(ircChannel.Name == target.Name)
         {
             findChannel = ircChannel;
         }
     }
     if (Utilities.CheckOp(source.Name, findChannel))
     {
         try
         {
             Channels Watch = new Channels();
             foreach (Channels c in TwitchChannels)
             {
                 if (findChannel.Name == c.ChannelName)
                 {
                     Watch = c;
                 }//if (findChannel.Name == c.ChannelName)
             }//foreach (Channels c in TwitchChannels)
             // config writing
             XElement newStreamer = new XElement("streamer");
             newStreamer.SetAttributeValue("value", username);
             XElement xElem = ConfigDocument.Descendants("servers").FirstOrDefault().Descendants("server").FirstOrDefault().Elements("channel").First(x => x.Attribute("id").Value == Watch.ChannelName);
             xElem.Descendants("streamers").FirstOrDefault().Add(newStreamer);
             TwitchStuff twitchInfo = new TwitchStuff();
             twitchInfo.UpdateInfo(username,this);
             Watch.Streamers.Add(username);
             Watch.StreamInfo.Add(twitchInfo);
             returnvalue = true;
             ConfigDocument.Save(FileName);
         }//try
         catch (Exception ex)
         {
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("ERROR: " + ex.Message);
             Console.ForegroundColor = ConsoleColor.Gray;
             returnvalue = false;
         }
     }
     ModifyingConfig = false;
     return returnvalue;
 }
开发者ID:stauken,项目名称:twitchbot,代码行数:47,代码来源:ConfigurationReader.cs

示例7: IrcCommand

        public IrcCommand(
            IrcBot bot, 
            IrcBotUser user,
            IrcClient client, 
            string[] parameters, 
            IIrcMessageTarget target, 
            IIrcMessageSource source
        )
        {
            this.Bot = bot;
            this.User = user;
            this.Client = client;
            this.Target = target;
            this.Source = source;

            ParseParameters(parameters);
        }
开发者ID:koushikajay,项目名称:Alfred,代码行数:17,代码来源:IrcCommand.cs

示例8: ProcessChatCommandSend

        private void ProcessChatCommandSend(IrcClient client, IIrcMessageSource source,
            IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
        {
            var sourceUser = (IrcUser)source;
            var twitterBotUser = GetTwitterBotUser(sourceUser);

            if (parameters.Count != 1)
                throw new InvalidCommandParametersException(1);

            // Send tweet from user.
            var tweetStatus = twitterBotUser.SendTweet(parameters[0].TrimStart());
            var replyTargets = GetDefaultReplyTarget(client, sourceUser, targets);
            client.LocalUser.SendMessage(replyTargets, "Tweet sent by {0} at {1}.", tweetStatus.User.ScreenName,
                tweetStatus.CreatedDate.ToLongTimeString());
        }
开发者ID:jaddie,项目名称:Irc.Net-4.0-Project---Fork,代码行数:15,代码来源:TwitterBot.cs

示例9: ProcessChatCommandLogIn

        private void ProcessChatCommandLogIn(IrcClient client, IIrcMessageSource source,
            IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
        {
            var sourceUser = (IrcUser)source;
            var twitterUser = this.twitterUsers.SingleOrDefault(tu => tu.IrcUser == sourceUser);
            if (twitterUser != null)
                throw new InvalidOperationException(string.Format(
                    "User '{0}' is already logged in to Twitter as {1}.", sourceUser.NickName,
                    twitterUser.TwitterUser.ScreenName));

            if (parameters.Count != 2)
                throw new InvalidCommandParametersException(1);

            // Create new Twitter user and log in.
            var twitterBotUser = new TwitterBotUser(sourceUser);
            twitterBotUser.LogIn(parameters[0], parameters[1]);
            this.twitterUsers.Add(twitterBotUser);

            var replyTargets = GetDefaultReplyTarget(client, sourceUser, targets);
            client.LocalUser.SendMessage(replyTargets, "You are now logged in as {0} / '{1}'.",
                twitterBotUser.TwitterUser.ScreenName, twitterBotUser.TwitterUser.Name);
        }
开发者ID:jaddie,项目名称:Irc.Net-4.0-Project---Fork,代码行数:22,代码来源:TwitterBot.cs

示例10: ReadChatCommand

        /// <summary>
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <param name="source">
        /// </param>
        /// <param name="targets">
        /// </param>
        /// <param name="command">
        /// </param>
        /// <param name="parameters">
        /// </param>
        private void ReadChatCommand(
            IrcClient client,
            IIrcMessageSource source,
            IList<IIrcMessageTarget> targets,
            string command,
            string[] parameters)
        {
            IList<IIrcMessageTarget> defaultReplyTarget = this.GetDefaultReplyTarget(client, source, targets);

            ChatCommandProcessor processor;
            if (this.chatCommandProcessors.TryGetValue(command, out processor))
            {
                try
                {
                    processor(client, source, targets, command, parameters);
                }
                catch (InvalidCommandParametersException exInvalidCommandParameters)
                {
                    client.LocalUser.SendNotice(defaultReplyTarget, exInvalidCommandParameters.GetMessage(command));
                }
                catch (Exception ex)
                {
                    if (source is IIrcMessageTarget)
                    {
                        client.LocalUser.SendNotice(
                            defaultReplyTarget,
                            "Error processing '{0}' command: {1}",
                            command,
                            ex.Message);
                    }
                }
            }
            else
            {
                if (source is IIrcMessageTarget)
                {
                    client.LocalUser.SendNotice(defaultReplyTarget, "Command '{0}' not recognized.", command);
                }
            }
        }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:52,代码来源:IrcBot.cs

示例11: HandleNoticeReceived

 internal void HandleNoticeReceived(IIrcMessageSource source, IList<IIrcMessageTarget> targets, string text)
 {
     var previewEventArgs = new IrcPreviewMessageEventArgs(source, targets, text, this.Client.TextEncoding);
     OnPreviewNoticeReceived(previewEventArgs);
     if (!previewEventArgs.Handled)
         OnNoticeReceived(new IrcMessageEventArgs(source, targets, text, this.Client.TextEncoding));
 }
开发者ID:toddhainsworth,项目名称:ircdotnet,代码行数:7,代码来源:IrcChannel.cs

示例12: IrcMessageEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcMessageEventArgs"/> class.
        /// </summary>
        /// <param name="source">The source of the message.</param>
        /// <param name="targets">A list of the targets of the message.</param>
        /// <param name="text">The text of the message.</param>
        /// <param name="encoding">The encoding of the message text.</param>
        /// <exception cref="ArgumentNullException"><paramref name="targets"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="text"/> is <see langword="null"/>.</exception>
        public IrcMessageEventArgs(IIrcMessageSource source, IList<IIrcMessageTarget> targets, string text,
            Encoding encoding)
            : base()
        {
            if (targets == null)
                throw new ArgumentNullException("target");
            if (text == null)
                throw new ArgumentNullException("text");
            if (encoding == null)
                throw new ArgumentNullException("textEncoding");

            this.Source = source;
            this.Targets = new ReadOnlyCollection<IIrcMessageTarget>(targets);
            this.Text = text;
            this.Encoding = encoding;
        }
开发者ID:toddhainsworth,项目名称:ircdotnet,代码行数:25,代码来源:IrcEventArgs.cs

示例13: ProcessChatCommandZoneInfo

        private void ProcessChatCommandZoneInfo(
            IrcClient client,
            IIrcMessageSource source,
            IList<IIrcMessageTarget> targets,
            string command,
            IList<string> parameters)
        {
            if (!this.executingRequestPlayfieldList)
            {
                this.executingRequestPlayfieldList = true;
                int numberOfZoneEnginesConnected = Program.ISCom.ClientCount;
                List<string> addressList = Program.ISCom.GetZoneEngineIds();

                Program.ISCom.BroadCast(new RequestPlayfieldList());

                StringBuilder sb = new StringBuilder();
                var sourceUser = (IrcUser)source;
                IList<IIrcMessageTarget> replyTargets = this.GetDefaultReplyTarget(client, sourceUser, targets);

                DateTime startWait = DateTime.UtcNow;

                bool timeOut = true;
                while ((DateTime.UtcNow - startWait < TimeSpan.FromSeconds(10) && timeOut))
                {
                    lock (this.replyQueuePlayfieldList)
                    {
                        if (this.replyQueuePlayfieldList.Count == Program.ISCom.ClientCount)
                        {
                            timeOut = false;
                        }
                    }
                }
                if (timeOut)
                {
                    client.LocalUser.SendMessage(replyTargets, "{0}", "Not all ZoneEngines replied.");
                }

                client.LocalUser.SendMessage(
                    replyTargets,
                    "{0}",
                    "Number of ZoneEngines connected: " + numberOfZoneEnginesConnected);

                while (this.replyQueuePlayfieldList.Count > 0)
                {
                    RequestPlayfieldList r = this.replyQueuePlayfieldList.Dequeue();
                    client.LocalUser.SendMessage(
                        replyTargets,
                        "{0}: Playfields {1}",
                        r.ZoneEngineAddress,
                        string.Join(
                            ", ",
                            r.PlayfieldIds.Select(
                                x => PlayfieldLoader.PFData[x.Instance].Name.Trim() + " (" + x.Instance + ")")
                                .ToArray()));
                }
                this.executingRequestPlayfieldList = false;
            }
        }
开发者ID:CellAO,项目名称:CellAO-NightPredator,代码行数:58,代码来源:RelayBot.cs

示例14: ProcessChatCommandSend

        /// <summary>
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <param name="source">
        /// </param>
        /// <param name="targets">
        /// </param>
        /// <param name="command">
        /// </param>
        /// <param name="parameters">
        /// </param>
        private void ProcessChatCommandSend(
            IrcClient client,
            IIrcMessageSource source,
            IList<IIrcMessageTarget> targets,
            string command,
            IList<string> parameters)
        {
            var sourceUser = (IrcUser)source;
            // var twitterBotUser = GetTwitterBotUser(sourceUser);
            if (parameters.Count != 1)
                throw new InvalidCommandParametersException(1);

            //Send System Message.
            //TODO: Add GM Check and Sending System Message Code here

            //Twitter Code Delete this crap after new code is written.
            // var tweetStatus = twitterBotUser.SendTweet(parameters[0].TrimStart());
            // var replyTargets = GetDefaultReplyTarget(client, sourceUser, targets);
            // client.LocalUser.SendMessage(replyTargets, "Tweet sent by {0} at {1}.", tweetStatus.User.ScreenName,
            // tweetStatus.CreatedDate.ToLongTimeString());
        }
开发者ID:CellAO,项目名称:CellAO-NightPredator,代码行数:33,代码来源:RelayBot.cs

示例15: ProcessChatCommandRegister

 /// <summary>
 /// 
 /// </summary>
 /// <param name="client"></param>
 /// <param name="source"></param>
 /// <param name="targets"></param>
 /// <param name="command"></param>
 /// <param name="parameters"></param>
 private void ProcessChatCommandRegister(
     IrcClient client,
     IIrcMessageSource source,
     IList<IIrcMessageTarget> targets,
     string command,
     IList<string> parameters)
 {
     //TODO: Add Command to register user for CellAO
 }
开发者ID:CellAO,项目名称:CellAO-NightPredator,代码行数:17,代码来源:RelayBot.cs


注:本文中的IIrcMessageSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。