コード例 #1
0
 public static IrcBot GetBot(IrcBotSettings settings)
 {
     IrcBot bot;
     lock (bots) {
         if (!bots.TryGetValue(settings, out bot)) {
             bot = new IrcBot(settings);
             bots[settings] = bot;
         }
     }
     return bot;
 }
コード例 #2
0
        public static IrcBot GetBot(IrcBotSettings settings)
        {
            IrcBot bot;

            lock (bots) {
                if (!bots.TryGetValue(settings, out bot))
                {
                    bot            = new IrcBot(settings);
                    bots[settings] = bot;
                }
            }
            return(bot);
        }
コード例 #3
0
 void SendIrcMessage(string message)
 {
     Console.WriteLine(message);
     try {
         IrcBotSettings settings = new IrcBotSettings(
             this.Server, this.Port,
             this.Nick ?? "ccnetbot",
             this.RealName ?? "CCnet IRC Publisher");
         IrcBot   bot      = IrcBot.GetBot(settings);
         string[] channels = this.Room.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string channel in channels)
         {
             bot.SendMessage(channel, message);
         }
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
     }
 }