예제 #1
0
        public SpiffCore(string channel, string botName, string outh, string pluginDirectory)
        {
            Channel      = channel;
            BotName      = botName;
            PluginLoader = new PluginLoader(pluginDirectory);

            Commands = new Dictionary <string, Command>();

            Instance = this;

            IrcClient = new IRCClient(channel, botName, outh, this);

            IrcClient.OnTwitchEvent += IrcClientOnOnTwitchEvent;

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
        }
예제 #2
0
        static void Main(string[] args)
        {
            if (!Directory.Exists("Plugins"))
                Directory.CreateDirectory("Plugins");

            if (!File.Exists("Config.ini"))
            {
                ConfigFile.SetValue("auth", "Username", "ToyzBot");
                ConfigFile.SetValue("auth", "oauth", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
                ConfigFile.SetValue("channel", "channel", "thetoyz");
                ConfigFile.SetValue("adv", "debug", false);
                ConfigFile.Flush();

                Logger.Info("...SpiffBot...", "SpiffBot");
                Logger.Error("Please Edit Config.ini with your settings...", "SpiffBot");

                Console.ReadKey();
                Environment.Exit(0);
            }

            string pluginPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins");
            Logger.Info("Please Wait... Spiffbot is loading...", "SpiffBot");
            _server = new SpiffCore(ConfigFile.GetValue("channel", "channel", "thetoyz"), ConfigFile.GetValue("auth", "Username", "ToyzBot"), ConfigFile.GetValue("auth", "oauth", "oauth"), pluginPath);

            Logger.Info("Loading all plugins", "SpiffBot");
            SpiffCore.Instance.PluginLoader.LoadPlugins();
            SpiffCore.Instance.PluginLoader.StartPlugins();
            Logger.Info("Plugins have been loaded", "SpiffBot");
            _server.IrcClient.OnTwitchDataDebugOut += IrcClientOnOnTwitchDataDebugOut;
            _server.IrcClient.Start();

            new Thread(TitleUpdater).Start();
            Logger.Info("Spiffbot has started and conntected to twitch", "SpiffBot");

            Console.CancelKeyPress += ConsoleOnCancelKeyPress;
        }