• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IrcDotNet.IrcChannel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ShowScores

		private void ShowScores(IrcChannel channel)
		{
			foreach(var score in _scores.OrderBy(s => s.Points).Reverse().Take(5))
			{
				_bot.Say(channel.Name, string.Format("{0}: {1} points", score.Nickname, score.Points));
			}
		}
开发者ID:skovsende,项目名称:TriviaBot.Net,代码行数:7,代码来源:TriviaPlugin.cs


示例2: IrcChannelViewModel

        /// <summary>
        /// Initializes a new instance of the IrcChannelViewModel class
        /// </summary>
        public IrcChannelViewModel(IrcChannel channel, string networkName, Settings settings)
        {
            this.Settings = settings;
              this.Message = string.Empty;
              this.Messages = new BindableCollection<Message>();
              this.Closable = true;
              this.DisplayName = channel.Name;
              this.networkName = networkName;
              this.personalHistory = new List<string>();
              this.events = IoC.Get<IEventAggregator>();
              this.filterService = IoC.Get<FilterService>();
              this.Channel = channel;
              this.Channel.ModesChanged += this.channelModesChanged;
              this.Channel.UsersListReceived += this.channelUsersListReceived;
              this.Channel.MessageReceived += this.channelMessageReceived;
              this.Channel.UserJoined += this.channelUserJoined;
              this.Channel.UserLeft += this.channelUserLeft;
              this.Channel.NoticeReceived += this.channelNoticeReceived;
              this.Channel.TopicChanged += this.channelTopicChanged;

              DirectoryInfo di = new DirectoryInfo(Settings.PATH + "\\logs\\");
              if (!di.Exists)
            di.Create();
              if (this.Settings.CanLog)
            this.logger = new Logger(String.Format("{0}\\logs\\{1}.{2}.txt",
                                 Settings.PATH,
                                 channel.Name,
                                 networkName));

              this.Channel.GetTopic();
              this.Users = new List<IrcChannelUser>();
        }
开发者ID:schwarz,项目名称:handle,代码行数:35,代码来源:IrcChannelViewModel.cs


示例3: OnChannelMessageReceived

        protected override void OnChannelMessageReceived(IrcChannel channel, IrcMessageEventArgs e)
        {
            var client = channel.Client;

            if (e.Source is IrcUser)
            {
                // Train Markov generator from received message text.
                // Assume it is composed of one or more coherent sentences that are themselves are composed of words.
                var sentences = e.Text.Split(sentenceSeparators);
                foreach (var s in sentences)
                {
                    string lastWord = null;
                    foreach (var w in s.Split(' ').Select(w => cleanWordRegex.Replace(w, string.Empty)))
                    {
                        if (w.Length == 0)
                            continue;
                        // Ignore word if it is first in sentence and same as nick name.
                        if (lastWord == null && channel.Users.Any(cu => cu.User.NickName.Equals(w,
                            StringComparison.InvariantCultureIgnoreCase)))
                            break;

                        markovChain.Train(lastWord, w);
                        lastWord = w;
                        this.numTrainingWordsReceived++;
                    }
                    markovChain.Train(lastWord, null);
                }

                this.numTrainingMessagesReceived++;
            }
        }
开发者ID:IrcDotNet,项目名称:IrcDotNet,代码行数:31,代码来源:MarkovChainTextBot.cs


示例4: IrcChannelEventArgs

        /// <inheritdoc/>
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcChannelEventArgs"/> class.
        /// </summary>
        /// <param name="channel">The channel that the event concerns.</param>
        public IrcChannelEventArgs(IrcChannel channel, string comment = null)
            : base(comment)
        {
            if (channel == null)
                throw new ArgumentNullException("channel");

            this.Channel = channel;
        }
开发者ID:toddhainsworth,项目名称:ircdotnet,代码行数:13,代码来源:IrcEventArgs.cs


示例5: IrcChannelInvitationEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcChannelInvitationEventArgs"/> class.
        /// </summary>
        /// <param name="channel">The channel to which the recipient user is invited.</param>
        /// <param name="inviter">The user inviting the recipient user to the channel.</param>
        public IrcChannelInvitationEventArgs(IrcChannel channel, IrcUser inviter)
            : base(channel)
        {
            if (inviter == null)
                throw new ArgumentNullException("inviter");

            this.Inviter = inviter;
        }
开发者ID:toddhainsworth,项目名称:ircdotnet,代码行数:13,代码来源:IrcEventArgs.cs


示例6: OnChannelMessageReceived

 protected override void OnChannelMessageReceived(IrcChannel channel, IrcMessageEventArgs e)
 {
     var client = channel.Client;
     if (e.Source is IrcUser)
     {
         // TODO: keep log of recent chats?
     }
 }
开发者ID:amauragis,项目名称:BofhDotNet,代码行数:8,代码来源:BofhBot.cs


示例7: ChannelBot

        public ChannelBot(IrcChannel channel)
        {
            Channel = channel;

            Channel.UsersListReceived += ChannelOnUsersListReceived;
            Channel.UserJoined += ChannelOnUserJoined;
            Channel.UserLeft += ChannelOnUserLeft;
            Channel.MessageReceived += ChannelOnMessageReceived;
            Channel.Client.RawMessageSent += ClientOnRawMessageSent;
        }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:10,代码来源:ChannelBot.cs


示例8: OnChannelModeChanged

 protected override void OnChannelModeChanged(IrcChannel channel, IrcUser source, string newModes, IEnumerable<string> newModeParameters) { 
     // Twitch doesn't actually send JOIN messages. This means we need to add users
     // to the channel when changing their mode if we haven't already.
     foreach (string username in newModeParameters)
     {
         IrcUser user = GetUserFromNickName(username);
         if (channel.GetChannelUser(user) == null)
             channel.HandleUserJoined(new IrcChannelUser(user));
     }
 }
开发者ID:Sebioff,项目名称:ParkitectTwitchIntegration,代码行数:10,代码来源:TwitchIrcClient.cs


示例9: MessageReceived

		private void MessageReceived(IrcChannel channel, string source, string text)
		{
			if(text.StartsWith("!scores"))
				ShowScores(channel);

			if(text.StartsWith("!trivia") && _currentQuestion == null)
				StartQuestion(channel);

			if(_currentQuestion != null)
				CheckForCorrectAnswer(text, channel, source);
		}
开发者ID:skovsende,项目名称:TriviaBot.Net,代码行数:11,代码来源:TriviaPlugin.cs


示例10: ChannelBot

        public ChannelBot(IrcChannel channel)
        {
            Channel = channel;

            Channel.UsersListReceived += ChannelOnUsersListReceived;
            Channel.UserJoined += ChannelOnUserJoined;
            Channel.UserLeft += ChannelOnUserLeft;
            Channel.MessageReceived += ChannelOnMessageReceived;
            var b = new ChatterBotAPI.ChatterBotFactory().Create(ChatterBotType.CLEVERBOT);
            Bot = b.CreateSession();
            //HelloTimerOnElapsed(null, null);
        }
开发者ID:kellyelton,项目名称:OctgnHelpBot,代码行数:12,代码来源:ChannelBot.cs


示例11: CheckOp

 public static bool CheckOp(string UserNick, IrcChannel Channel)
 {
     foreach (IrcChannelUser user in Channel.Users)
     {
         if (user.User.NickName == UserNick && (user.Modes.Contains('o') || user.Modes.Contains('h')))
         {
             return true;
         }//if (user.User.NickName == e.Source.Name && (user.Modes.Contains('o') || user.Modes.Contains('h')))
         else if (user.User.NickName == UserNick && (!user.Modes.Contains('o') && !user.Modes.Contains('h')))
         {
             return false;
         }
     }//foreach (IrcChannelUser user in Channel.Users)
     return false;
 }
开发者ID:stauken,项目名称:twitchbot,代码行数:15,代码来源:Utilities.cs


示例12: CheckOwner

 public static bool CheckOwner(string OwnerIdentity, IrcChannel Channel)
 {
     foreach(IrcChannelUser user in Channel.Users)
     {
         if (user.User.HostName == OwnerIdentity)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     return false;
 }
开发者ID:stauken,项目名称:twitchbot,代码行数:15,代码来源:Utilities.cs


示例13: CheckForCorrectAnswer

		private void CheckForCorrectAnswer(string text, IrcChannel channel, string source)
		{
			if (_currentQuestion.Answers.Contains(text.ToLower()))
			{
				_bot.Say(channel.Name, source + " rocks!");
				_currentQuestion = null;

				AddToScores(source);
				
				if(_scores.Sum(x => x.Points) == 10)
				{
					_bot.Say(channel.Name, _scores.OrderBy(s => s.Points).Reverse().First().Nickname + " is the winner");
					ShowScores(channel);
					_scores.Clear();
				}
				else
				{
					StartQuestion(channel);
				}
			}
		}
开发者ID:skovsende,项目名称:TriviaBot.Net,代码行数:21,代码来源:TriviaPlugin.cs


示例14: SubscribeToChannelEvents

 private void SubscribeToChannelEvents(IrcChannel channel)
 {
     channel.MessageReceived += OnChannelMessageReceived;
     channel.UserLeft += OnUserLeft;
 }
开发者ID:koushikajay,项目名称:Alfred,代码行数:5,代码来源:IrcBot.cs


示例15: HandleInviteReceived

 internal void HandleInviteReceived(IrcUser inviter, IrcChannel channel)
 {
     OnInviteReceived(new IrcChannelInvitationEventArgs(channel, inviter));
 }
开发者ID:IrcDotNet,项目名称:IrcDotNet,代码行数:4,代码来源:IrcUser.cs


示例16: GetChannelFromName

        /// <summary>
        /// Gets the channel with the specified name, creating it if necessary.
        /// </summary>
        /// <param name="channelName">The name of the channel.</param>
        /// <param name="createdNew"><see langword="true"/> if the channel object was created during the call;
        /// <see langword="false"/>, otherwise.</param>
        /// <returns>The channel object that corresponds to the specified name.</returns>
        protected IrcChannel GetChannelFromName(string channelName, out bool createdNew)
        {
            if (channelName == null)
                throw new ArgumentNullException("channelName");
            if (channelName.Length == 0)
                throw new ArgumentException(Properties.Resources.MessageValueCannotBeEmptyString, "channelName");

            // Search for channel with given name in list of known channel. If it does not exist, add it.
            lock (((ICollection)this.channelsReadOnly).SyncRoot)
            {
                var channel = this.channels.SingleOrDefault(c => c.Name == channelName);
                if (channel == null)
                {
                    channel = new IrcChannel(channelName);
                    channel.Client = this;
                    this.channels.Add(channel);

                    createdNew = true;
                }
                else
                {
                    createdNew = false;
                }

                return channel;
            }
        }
开发者ID:txdv,项目名称:ircdotnet,代码行数:34,代码来源:IrcClient.cs


示例17: SetChannelModes

 internal void SetChannelModes(IrcChannel channel, string modes, IEnumerable<string> modeParameters = null)
 {
     SendMessageChannelMode(channel.Name, modes, modeParameters);
 }
开发者ID:txdv,项目名称:ircdotnet,代码行数:4,代码来源:IrcClient.cs


示例18: OnChannelUserLeft

 protected override void OnChannelUserLeft(IrcChannel channel, IrcChannelUserEventArgs e)
 {
     //
 }
开发者ID:jaddie,项目名称:Irc.Net-4.0-Project---Fork,代码行数:4,代码来源:TwitterBot.cs


示例19: OnChannelNoticeReceived

 /// <summary>
 /// </summary>
 /// <param name="channel">
 /// </param>
 /// <param name="e">
 /// </param>
 protected abstract void OnChannelNoticeReceived(IrcChannel channel, IrcMessageEventArgs e);
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:7,代码来源:IrcBot.cs


示例20: OnChannelMessageReceived

 /// <summary>
 /// </summary>
 /// <param name="channel">
 /// </param>
 /// <param name="e">
 /// </param>
 protected override void OnChannelMessageReceived(IrcChannel channel, IrcMessageEventArgs e)
 {
     this.RelayedChannel.ChannelMessage(this.nickname + "-" + e.Source.Name, e.Text);
 }
开发者ID:kittin,项目名称:CellAO-NightPredator,代码行数:10,代码来源:RelayBot.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IrcDotNet.IrcClient类代码示例发布时间:2022-05-26
下一篇:
C# Zlib.ZlibStream类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap