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


C# IrcDotNet.IrcClient类代码示例

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


IrcClient类属于IrcDotNet命名空间,在下文中一共展示了IrcClient类的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: SayInChannels

 public static void SayInChannels(IrcClient client, string msg)
 {
     foreach (var channel in client.Channels)
     {
         client.LocalUser.SendMessage(channel, msg);
     }
 }
开发者ID:djeebus,项目名称:MusicHub,代码行数:7,代码来源:IrcHelper.cs

示例3: Execute

        public void Execute(IrcClient Client, string channel, IrcUser Sender, string message)
        {
            message = message.Trim();
            if (message == "")
            {
                Client.LocalUser.SendMessage(channel, horoscopeHelpMsg());
            }
            else
            {

                if (!signs.ContainsKey(message))
                {
                    Client.LocalUser.SendMessage(channel, "Why won't you give me a sign~");
                    return;
                }

                string html = getHTML(signs[message]);

                string horoscope = dropHtmlPrecedingHoroscope(html, message);
                horoscope = dropHtmlTailingHoroscope(horoscope);
                horoscope = html2Txt(horoscope);

                Client.LocalUser.SendMessage(channel, horoscope);
            }
        }
开发者ID:code-n-beer,项目名称:SimoBot,代码行数:25,代码来源:HoroscopeFeature.cs

示例4: HandleEventLoop

        private static void HandleEventLoop(IrcClient client)
        {
            _ircLocaluser = client.LocalUser;
              _hostNameToWebSockets.Add("", new WebSocketListenerClient(PrivateConstants.TestAccountWebsocketAuth));
              _hostNameToWebSockets[""].Run(sendToIrcProcessor);

              bool isExit = false;
              while (!isExit) {
            Console.Write("> ");
            var command = Console.ReadLine();
            switch (command) {
              case "exit":
            isExit = true;
            break;
              default:
            if (!string.IsNullOrEmpty(command)) {
              if (command.StartsWith("/") && command.Length > 1) {
                client.SendRawMessage(command.Substring(1));
              } else {
                Console.WriteLine($"Unknown command '{command}'");
              }
            }
            break;
            }
              }
              client.Disconnect();
        }
开发者ID:destinygg,项目名称:bot,代码行数:27,代码来源:Program.cs

示例5: ChannelSearchViewModel

 public ChannelSearchViewModel(IrcClient client)
 {
     this.client = client;
       this.allChannels = new List<BindableChannelInfo>();
       this.Channels = new BindableCollection<BindableChannelInfo>();
       this.client.ChannelListReceived += ircClient_ChannelListReceived;
       this.DisplayName = "Join Channel";
 }
开发者ID:schwarz,项目名称:handle,代码行数:8,代码来源:ChannelSearchViewModel.cs

示例6: InvalidSyncLibraryCommand

 protected void InvalidSyncLibraryCommand(
     IrcClient client, 
     IList<IIrcMessageTarget> replyTarget, 
     string commandError)
 {
     client.LocalUser.SendMessage(replyTarget, string.Format("Invalid .sync-command: {0}", commandError));
     client.LocalUser.SendMessage(replyTarget, "Usage: .sync-library library-guid");
 }
开发者ID:djeebus,项目名称:MusicHub,代码行数:8,代码来源:BaseCommand.cs

示例7: Start

        /// <summary>
        /// 
        /// </summary>
        /// <param name="twitchUsername"></param>
        /// <param name="twitchOAuthToken">
        /// A chat login token which can be generated here: http://www.twitchapps.com/tmi/
        /// </param>
        public void Start(string twitchUsername, string twitchOAuthToken)
        {
            var client = new IrcClient();

            client.Connected += client_Connected;
            client.ChannelListReceived += client_ChannelListReceived;
            client.RawMessageReceived += client_RawMessageReceived;

            client.Connect("irc.twitch.tv", 6667, false, new IrcUserRegistrationInfo() {NickName = twitchUsername, Password = twitchOAuthToken, UserName = twitchUsername, RealName = twitchUsername});
        }
开发者ID:GrimPanda,项目名称:x-plays-gameboy,代码行数:17,代码来源:TwitchChatEngine.cs

示例8: Client

        public Client(Server server)
        {
            client = new IrcClient();
            this.server = server;

            channels = getChannels(server);

            SetEventHandlers();
            findClientConfs();
        }
开发者ID:code-n-beer,项目名称:SimoBot,代码行数:10,代码来源:Client.cs

示例9: Irc

        public ActionResult Irc()
        {
            var api = new AppHarborApi(new AuthInfo { AccessToken = ConfigurationManager.AppSettings["authToken"] });

            var latestBuild = api.GetBuilds(Constants.AppHarborAppName).First();
            var testResults = api.GetTests(Constants.AppHarborAppName, latestBuild.ID);
            List<AppHarbor.Model.Test> allTests = new List<AppHarbor.Model.Test>();

            foreach (var testresult in testResults)
            {
                FillTests(allTests, testresult);
            }

            AutoResetEvent are = new AutoResetEvent(false);
            IrcDotNet.IrcClient client = new IrcDotNet.IrcClient();

            try
            {
                client.Connect("irc.gamesurge.net", false, new IrcUserRegistrationInfo() { NickName = "crymono-build", RealName = "crymono", UserName = "crymono" });

                client.ClientInfoReceived += (s, e) => are.Set();

                are.WaitOne();

                client.Channels.Join(new string[] { "#crymono" });

                Thread.Sleep(200);
                string msg = latestBuild.Commit.Message.Replace("\n", "").Replace("\r", "");

                client.LocalUser.SendMessage("#crymono", "Build finished, latest commit: " + msg);
                Thread.Sleep(200);

                int numPassedTests = allTests.Count(t => t.Status == "Passed");
                float percentage = (float)numPassedTests / allTests.Count * 100;
                client.LocalUser.SendMessage("#crymono", String.Format("Test results: {0} of {1} passed ({2:0}%) - http://crymono.apphb.com/#!/{3} - AppHB: https://appharbor.com/applications/crymonobuild/builds/{3}/tests",
                    numPassedTests,
                    allTests.Count,
                    percentage,
                    latestBuild.ID
                    ));
                Thread.Sleep(200);

            }
            finally
            {
                if (client != null && client.IsConnected)
                {
                    client.Quit("to the hills!");
                    Thread.Sleep(200);
                    client.Disconnect();
                }
            }

            return Content("OK");
        }
开发者ID:PoppermostProductions,项目名称:CryMono-web,代码行数:55,代码来源:NotifyController.cs

示例10: 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

示例11: IrcQueryViewModel

 public IrcQueryViewModel(IrcUser user, IrcClient client, Settings settings)
 {
     this.Settings = settings;
       this.User = user;
       this.client = client;
       this.DisplayName = user.NickName;
       this.Messages = new BindableCollection<Message>();
       this.Closable = true;
       // TODO
       this.client.LocalUser.MessageReceived += this.messageReceived;
 }
开发者ID:schwarz,项目名称:handle,代码行数:11,代码来源:IrcQueryViewModel.cs

示例12: IrcStatusTabViewModel

        /// <summary>
        /// Initializes a new instance of the IrcChannelViewModel class
        /// </summary>
        public IrcStatusTabViewModel(IrcClient client)
        {
            this.Messages = new BindableCollection<Message>();
              this.Closable = false;
              this.DisplayName = "Status";
              this.Client = client;

              this.Client.LocalUser.MessageReceived += this.localUserMessageReceived;
              this.Client.MotdReceived += this.clientMessageOfTheDayReceived;
              this.Client.WhoIsReplyReceived += this.clientWhoIsReplyReceived;
        }
开发者ID:schwarz,项目名称:handle,代码行数:14,代码来源:IrcStatusTabViewModel.cs

示例13: 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:gkinsman,项目名称:StatsBot,代码行数:12,代码来源:BasicIrcBot.cs

示例14: IrcBot

        public IrcBot(IrcBotConfiguration configuration)
        {
            this.tasks = new List<IIrcTask>();
            this.users = new ConcurrentDictionary<string, IrcBotUser>();

            configuration.UserName = configuration.UserName ?? configuration.NickName;
            configuration.RealName = configuration.RealName?? configuration.NickName;

            this.Configuration = configuration;

            this.commandPrefix = string.Format("{0}", this.Configuration.NickName.ToLower());

            this.client = new IrcClient();
        }
开发者ID:koushikajay,项目名称:Alfred,代码行数:14,代码来源:IrcBot.cs

示例15: ConnectAndSetup

 public void ConnectAndSetup()
 {
     _client = new IrcClient();
     _client.Connect("irc.homelien.no", 6667, false, new IrcUserRegistrationInfo
         {
             NickName = "testL",
             UserName = "testLK",
             RealName = "LarsBot"
         });
     _client.Connected += ClientOnConnected;
     _client.Disconnected += _client_Disconnected;
     _client.RawMessageReceived += _client_RawMessageReceived;
     _client.Error += ClientOnError;
     _client.ErrorMessageReceived += ClientOnErrorMessageReceived;
 }
开发者ID:bremnes,项目名称:IrcBot,代码行数:15,代码来源:RawIrcBot.cs


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