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; }
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); }
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()); } }