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


C# IrcUser类代码示例

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


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

示例1: HandleCommand

        public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
        {
            int num;
            if (paramList.Count() == 1)
            {
                // display random quote
                Connection.GetData(Data.UrlQuote, "get", jObject =>
                {
                    if ((bool)jObject["success"])
                    {
                        Utils.SendChannel((string)jObject["result"].SelectToken("id") + ": " +
                                          (string)jObject["result"].SelectToken("quote"));
                    }
                    else
                    {
                        Utils.SendChannel("No quotes found.");
                    }
                }, Utils.HandleException);
            }
            else if (paramList[1] == "add")
            {
                if (isIngameCommand == false)
                {
                    var quote = "";
                    for (var l = 2; l < paramList.Count(); l++)
                    {
                        quote = quote + paramList[l] + " ";
                    }

                    Connection.GetData(string.Format(Data.UrlQuoteAdd, user.Nick, user.Hostmask, quote.Trim()),
                        "get", jObject => Utils.SendChannel(string.Format("Quote #{0} has been added.", jObject["result"].SelectToken("id"))), Utils.HandleException);
                }
                else
                {
                    Utils.SendChannel("This command is restricted to the IRC channel only.");
                }
            }
            else if (int.TryParse(paramList[1], out num))
            {
                Connection.GetData(string.Format(Data.UrlQuoteSpecific, num), "get", jObject =>
                {
                    if ((bool)jObject["success"])
                    {
                        Utils.SendChannel((string)jObject["result"].SelectToken("quote"));
                    }
                    else
                    {
                        Utils.SendChannel("Specific quote not found.");
                    }
                }, Utils.HandleException);
            }
            else
            {
                Utils.SendChannel("Usage: !quote add <message>");
            }
        }
开发者ID:Citidel,项目名称:edgebot,代码行数:56,代码来源:Quote.cs

示例2: DccReceiveClient

        public DccReceiveClient(Dcc dcc, IrcUser user, Socket sock, IPEndPoint addr, FileInfo file, long totalSize,
								TimeSpan timeout)
            : base(dcc, user, sock, file, 0, totalSize)
        {
            m_remoteAddr = addr;
            // m_sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 10000)
            m_timeoutTimer = new Timer((int)timeout.TotalMilliseconds);
            m_timeoutTimer.Elapsed += OnTimeout;
            m_timeoutTimer.AutoReset = false;
            m_timeoutTimer.Start();
        }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:11,代码来源:DccRecieveClient.cs

示例3: IrcMessage

 public IrcMessage(IrcUser sender, string channel, string message, bool action = false)
 {
     Sender = sender;
     Channel = channel;
     Message = message;
     Action = action;
 }
开发者ID:Baggykiin,项目名称:ircsharp,代码行数:7,代码来源:IrcMessage.cs

示例4: DarkChat

 public DarkChat()
 {
     loadConfig();
     DarkLog.Debug(String.Format("[DarkChat] initialized version {0}", PLUGIN_VER));
     ircUser = new IrcUser(settings.Nick, settings.Ident, settings.NickServ, settings.RealName);
     ircClient = new IrcClient(settings.Server, ircUser);
 }
开发者ID:JoshBlake,项目名称:DarkChat,代码行数:7,代码来源:DarkChat.cs

示例5: CtcpErrorMessageReceivedEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="CtcpErrorMessageReceivedEventArgs"/> class,
 /// specifying that no error occurred.
 /// </summary>
 /// <param name="noErrorMessage">The message indicating that no error occurred.</param>
 public CtcpErrorMessageReceivedEventArgs(IrcUser user, string noErrorMessage)
     : base(user)
 {
     this.ErrorOccurred = false;
     this.FailedQuery = null;
     this.ErrorMessage = noErrorMessage;
 }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:12,代码来源:CtcpEventArgs.cs

示例6: HandleCommand

 public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
 {
     if (Utils.IsOp(user.Nick)|Utils.IsAdmin(user.Nick))
     {
         int i;
         // check if params number more than 4, if the pack length is less than 5 and the server is a number
         if (paramList.Count == 3 && paramList[1].Length < 5 && Int32.TryParse(paramList[2], out i))
         {
             Connection.GetData(String.Format(Data.UrlCrashLog, paramList[1], paramList[2]), "get", jObject =>
             {
                 if ((bool) jObject["success"])
                 {
                     Utils.SendChannel((string) jObject["result"]["response"]);
                 }
                 else
                 {
                     Utils.SendChannel("Failed to push crash log to pastebin. Please try again later.");
                 }
             }, Utils.HandleException);
         }
         else
         {
             Utils.SendChannel("Usage: !log <pack> <server_id>");
         }
     }
     else
     {
         Utils.SendChannel(Data.MessageRestricted);
     }
 }
开发者ID:Citidel,项目名称:edgebot,代码行数:30,代码来源:ServerLog.cs

示例7: HandleCommand

        public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
        {
            if (Utils.IsOp(user.Nick))
            {
                Connection.GetData(Data.UrlTps, "get", jObject =>
                {
                    string filter;
                    try
                    {
                        filter = paramList[1];
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        filter = "";
                    }

                    var outputString = "";
                    const string delimiter = ", ";
                    outputString = String.IsNullOrEmpty(filter) ? jObject["result"].Select(row => JsonConvert.DeserializeObject<JsonTps>(row.ToString())).Aggregate(outputString, (current, tps) => current + (Utils.FormatText(tps.Server.ToUpper(), Colors.Bold) + ":" + Utils.FormatTps(tps.Tps) + delimiter)) : jObject["result"].Select(row => JsonConvert.DeserializeObject<JsonTps>(row.ToString())).Where(tps => tps.Server.Contains(paramList[1])).Aggregate(outputString, (current, tps) => current + (Utils.FormatText(tps.Server.ToUpper(), Colors.Bold) + ":" + Utils.FormatTps(tps.Tps) + delimiter));
                    if (!String.IsNullOrEmpty(outputString))
                    {
                        Utils.SendChannel(outputString.Substring(0, outputString.Length - delimiter.Length));
                    }
                }, Utils.HandleException);
            }
            else
            {
                Utils.SendChannel(Data.MessageRestricted);
            }
        }
开发者ID:Citidel,项目名称:edgebot,代码行数:30,代码来源:TicksPerSecond.cs

示例8: StartIrc

        private void StartIrc()
        {
            var user = new IrcUser("");
            if (Properties.Settings.Default.nickserv == string.Empty)
                user = new IrcUser("twitchplaysagame", "twitchplaysagame");
            else
                user = new IrcUser(Properties.Settings.Default.user, Properties.Settings.Default.user);
            client = new IrcClient(Properties.Settings.Default.server, user);
            client.NetworkError += (s, e) => WriteConsole("Error: " + e.SocketError);

            client.ChannelMessageRecieved += (s, e) =>
            {
                ParseInput(e.PrivateMessage.User.Nick + ":" + e.PrivateMessage.Message);
            };
            client.ConnectionComplete += (s, e) =>
            {
                client.SendRawMessage("PRIVMSG {0} :{1}", "nickserv", "identify " + Properties.Settings.Default.nickserv);
                client.Channels.Join(Properties.Settings.Default.room);
                WriteConsole("Connected");
            };
            client.ConnectAsync();

            this.WriteConsole("Starting irc service");
            started = true;
            buttonStart.Text = "Stop";
        }
开发者ID:carriercomm,项目名称:TwitchMote,代码行数:26,代码来源:FormMain.cs

示例9: HandleCommand

 public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
 {
     if (Utils.IsOp(user.Nick))
     {
         if (paramList.Count < 3)
         {
             Utils.SendNotice("Usage: !announce <time in seconds> <repeats> <message>", user.Nick);
         }
         else
         {
             var msg = "";
             var timeTick = Convert.ToInt32(paramList[1])*1000;
             var timeCount = Convert.ToInt32(paramList[2]);
             if (timeTick == 0) return;
             Program.AnnounceTimer.Interval = timeTick;
             GC.KeepAlive(Program.AnnounceTimer);
             for (var i = 3; i < paramList.Count; i++)
             {
                 msg = msg + paramList[i] + " ";
             }
             Instances.Announcement.AnnounceMsg = msg;
             Instances.Announcement.AnnounceTimes = timeCount;
             Program.AnnounceTimer.Enabled = true;
         }
     }
     else
     {
         Utils.SendChannel(Data.MessageRestricted);
     }
 }
开发者ID:Citidel,项目名称:edgebot,代码行数:30,代码来源:Announcement.cs

示例10: HandleCommand

 public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
 {
     if (Utils.IsOp(user.Nick) ||
         user.Nick == "DrSmugleaf" ||
         user.Nick == "DrSmugleaf_")
     {
         var random = new Random().Next(0, 2);
         if (paramList.Count > 1)
         {
             switch (paramList[1])
             {
                 case "1":
                     Utils.SendChannel(Data.SmugResponses[0]);
                     break;
                 case "2":
                     Utils.SendChannel(Data.SmugResponses[1]);
                     break;
                 default:
                     Utils.SendChannel(Data.SmugResponses[random]);
                     break;
             }
         }
         else
         {
             Utils.SendChannel(Data.SmugResponses[random]);
         }
     }
     else
     {
         Utils.SendChannel("This command is useless.");
     }
 }
开发者ID:Citidel,项目名称:edgebot,代码行数:32,代码来源:JokeSmug.cs

示例11: DccClient

 public DccClient(Dcc dcc, IrcUser user)
 {
     m_dcc = dcc;
     m_user = user;
     m_startTime = DateTime.Now;
     m_closed = false;
 }
开发者ID:jaddie,项目名称:DarkWaterSupportBot,代码行数:7,代码来源:DccClient.cs

示例12: OnNewUser

 internal void OnNewUser(IrcUser user)
 {
     if (user.IrcClient.AutoResolveAuth && Authenticator != null)
     {
         ResolveAuth(user);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:7,代码来源:AuthenticationMgr.cs

示例13: Main

    private static void Main(){
      var ircUser = new IrcUser(Conf.Nick, Conf.User);
      var client = new IrcClient(Conf.Server, ircUser);
      var ChatBot = new BotAgent();
      ChatBot.Initialise();

      client.ConnectionComplete += (s, e) => {
        foreach (string chan in Conf.Channels)
          client.JoinChannel(chan);
      };

      client.ChannelMessageRecieved += (s, e) => {
        var source = e.PrivateMessage.Source;
        var channel = client.Channels[source];
        var message = e.PrivateMessage.Message;

        var urls = URLTitle.GetURLs(message);
        if (urls.Count != 0){
          var responseTitle = URLTitle.GetTitle(urls[0]);
          channel.SendMessage(responseTitle);
        }
        else{
          var query = ChatBot.Query(message);
          var response = ChatBot.Reply(query);
          Log(message, response.Output, Conf.Nick, source);
          channel.SendMessage(response.Output);
        }
      };

      client.NetworkError += (s, e) =>
        Console.WriteLine("Error: {0}", e.SocketError);
 
      client.ConnectAsync();
      while (true);
    }
开发者ID:LunarArcanus,项目名称:SharpBot,代码行数:35,代码来源:howlbot.cs

示例14: HandleCommand

        public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
        {
            int i;
            // check if the params number 4, that the number/sides are integers, and that number and sides are both greater than 0
            if (paramList.Count() == 3 && Int32.TryParse(paramList[1], out i) && Int32.TryParse(paramList[2], out i) &&
                (Int32.Parse(paramList[1]) > 0) && (Int32.Parse(paramList[2]) > 0) && (Int32.Parse(paramList[1]) <= 4) &&
                (Int32.Parse(paramList[2]) <= 100))
            {
                var dice = Int32.Parse(paramList[1]);
                var sides = Int32.Parse(paramList[2]);
                var random = new Random();

                var diceList = new List<int>();
                for (var j = 0; j < dice; j++)
                {
                    diceList.Add(random.Next(1, sides));
                }

                var outputString = String.Format("Rolling a {0} sided die, {1} time{2}: {3}", sides, dice,
                    (dice > 1) ? "s" : "", diceList.Aggregate("", (current, roll) => current + roll + " ").Trim());
                Utils.SendChannel(outputString);
            }
            else
            {
                Utils.SendChannel("Usage: !dice <number 1-4 > <sides 1 - 100>");
            }
        }
开发者ID:Citidel,项目名称:edgebot,代码行数:27,代码来源:JokeDice.cs

示例15: HandleCommand

        public override void HandleCommand(IList<string> paramList, IrcUser user, bool isIngameCommand)
        {
            if (!Utils.IsDev(user.Nick)) return;
            //var temp = new int[100];
            //for (var i = 0; i < 100; i++)
            //{
            //    temp[i] = GenerateRandom(0, 5);
            //}

            //var occur = new Dictionary<int, int>();
            //foreach (var item in temp)
            //{
            //    if (occur.ContainsKey(item))
            //    {
            //        occur[item] ++;
            //    }
            //    else
            //    {
            //        occur.Add(item, 1);
            //    }
            //}

            //foreach (var item in occur)
            //{
            //    Console.WriteLine(item.Key + ": " + item.Value);
            //}
        }
开发者ID:Citidel,项目名称:rrpain,代码行数:27,代码来源:Dev.cs


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