public Bot(string configFile, NetMaster master) { config = XDocument.Load(configFile); var server = (from s in config.Descendants("Server") select new { host = s.Element("Host").Value, port = s.Element("Port").Value, name = s.Element("Nickname").Value, channel = s.Element("Channel").Value, password = s.Element("Password") } ).ElementAt(0); if(master == null) { Log.Info("Connecting to " + server.host + ":" + server.port); this.net = new IrcMaster(server.host, Int32.Parse(server.port)); } else { this.net = master; } games = new GameManager(this); string password = null; if(server.password != null) { password = server.password.Value; } Log.Info("Logging in as " + server.name + " (Using Password: "******")"); if (net is IrcMaster) { (net as IrcMaster).Login(server.name, "MafiaBot V2", password); } mainChannel = net.GetChannel(server.channel); mainChannel.Commands.Add(new Commands.VariantsCommand()); mainChannel.Commands.Add(new Commands.CreateCommand(this)); mainChannel.Commands.Add(new Commands.ListCommand(this)); mainChannel.Commands.Add(new Commands.OpDestroyCommand(this)); mainChannel.Commands.Add(new Commands.HelpCommand()); }
internal NetChannel(NetMaster master, string name) : base(master, name, MessageSource.Channel) { }
internal NetUser(NetMaster master, string nick) : base(master, nick, MessageSource.Query) { this.Commands.Add(new Commands.CommandsCommand()); }
protected NetObject(NetMaster master, string name, MessageSource source) { this.master = master; this.name = name; this.source = source; }