private void SetupOnce() { if (isSetup) { return; } isSetup = true; MainBotData = new Main(DatabaseConnection.Create("Huffelpuff")); if (MainBotData.Channels.Count() == 0 && !Settings.Default.Channel.IsNullOrEmpty()) { foreach (var channelName in Settings.Default.Channel.Split(',')) { var channel = new Channel { ChannelName = channelName }; MainBotData.Channels.InsertOnSubmit(channel); } } MainBotData.SubmitChanges(); Encoding = System.Text.Encoding.UTF8; SendDelay = 3000; PingInterval = 120; ActiveChannelSyncing = true; OnRawMessage += RawMessageHandler; AutoRejoin = true; AutoRetry = true; AutoRetryDelay = 5; SupportNonRfc = true; OnChannelMessage += CommandDispatcher; OnQueryMessage += CommandDispatcher; OnConnected += OnBotConnected; CtcpVersion = VersionString + " (SharpIRC " + Assembly.GetAssembly(typeof(IrcFeatures)).GetName(false).Version + ")"; CtcpUrl = "https://github.com/FreeApophis/huffelpuff-irc-bot"; CtcpSource = "https://github.com/FreeApophis/huffelpuff-irc-bot"; // DCC Setup /* todo: find NAT / or our IP / sharp-IRC should be able to do that -> implement there */ //Setting up Access Control Acl = new AccessControlList(this); Acl.Init(); // Add Identify Plugin suitable (or all) Acl.AddIdentifyPlugin(new NickServIdentify(this)); Acl.AddIdentifyPlugin(new HostIdentify(this)); Acl.AddIdentifyPlugin(new PasswordIdentify(this)); Acl.AddIdentifyPlugin(new NickIdentify(this)); // Plugin needs the Handlers from IRC we load the plugins after we set everything up PlugManager = new BotPluginManager(this, "plugins"); PlugManager.PluginLoadEvent += PlugManagerPluginLoadEvent; PlugManager.StartUp(); //Basic Commands AddCommand(new Commandlet("!join", "The command !join <channel> lets the bot join Channel <channel>", JoinCommand, this, CommandScope.Both, "engine_join")); AddCommand(new Commandlet("!part", "The command !part <channel> lets the bot part Channel <channel>", PartCommand, this, CommandScope.Both, "engine_part")); AddCommand(new Commandlet("!channels", "The command !channels lists all channels where the bot resides", ListChannelCommand, this)); AddCommand(new Commandlet("!quit", "The command !quit lets the bot quit himself", QuitCommand, this, CommandScope.Both, "engine_quit")); //Plugin Commands AddCommand(new Commandlet("!plugins", "The command !plugins lists all the plugins", PluginsCommand, this)); AddCommand(new Commandlet("!activate", "The command !activate <plugin> activates the Plugin <plugin>", ActivateCommand, this, CommandScope.Both, "engine_activate")); AddCommand(new Commandlet("!deactivate", "The command !deactivate <plugin> deactivates the Plugin <plugin>", DeactivateCommand, this, CommandScope.Both, "engine_deactivate")); //Helper Commands (!commands) AddCommand(new Commandlet("!help", "The command !help <topic> gives you help about <topic> (special topics: commands, more)", HelpCommand, this)); //Settings Commands new SettingCommands(this); }