Beispiel #1
0
        public void Start()
        {
            QuestionUser = ((x) => UserDialog?.Invoke(x));
            Write        = ((x, z) => WriteToConsole?.Invoke(x, z));
            WriteLine    = ((x, z) => WriteLineToConsole?.Invoke(x, z));

            ThreadPool.QueueUserWorkItem(obj =>
            {
                if (!FirstTimeSetup(QuestionUser))
                {
                    throw new Exception("First Time Params Not Set");
                }

                IRCClient.Start(HandleUserCommands, Twitch.TwitchAPI._channel);

                TwitchAPI.Init();
                VoteSystem.Init();
                UserManager.Init();
                IRCClient.Init(ConsoleWrite);
                MemorySystem._instance.Init();
                Microphone.Init();
            });
        }
Beispiel #2
0
        public void Start(QuestionUser pMethod, WriteToUser pWriteMethod, WriteToUser pWriteLineMethod)
        {
            Write        = pWriteMethod;
            WriteLine    = pWriteLineMethod;
            QuestionUser = pMethod;

            if (!FirstTimeSetup(QuestionUser))
            {
                throw new Exception("First Time Params Not Set");
            }

            IRCClient.Start(HandleUserCommands, Twitch.TwitchAPI._channel);

            TwitchAPI.Init();
            VoteSystem.Init();
            UserManager.Init();
            IRCClient.Init(ConsoleWrite);
            MemorySystem._instance.Init();
            Microphone.Init();

            //IRCMessage message = new IRCMessage();
            //message.userName = userName;
            //message.channel = Twitch.TwitchAPI._channel;
        }
        public void Start(QuestionUser pMethod, WriteToUser pWriteMethod, WriteLineToUser pWriteLineMethod)
        {
            Write     = pWriteMethod;
            WriteLine = pWriteLineMethod;

            string userName = string.Empty;

            if (!File.Exists("Username.USER"))
            {
                userName = pMethod("UserName?");
                File.WriteAllText("Username.USER", userName);
            }
            else
            {
                userName = File.ReadAllText("Username.USER");
            }

            if (!File.Exists("SecretTokenDontLOOK.TOKEN"))
            {
                var password = pMethod("Token?");
                File.WriteAllText("SecretTokenDontLOOK.TOKEN", password);
            }

            if (!File.Exists("Channel.JOIN"))
            {
                var channel = pMethod("Channel?(Leave blank for your own channel)");

                if (String.IsNullOrEmpty(channel))
                {
                    channel = "#" + userName;
                }

                if (!channel.StartsWith("#"))
                {
                    channel = "#" + channel;
                }

                File.WriteAllText("Channel.JOIN", channel);
                Twitch.TwitchAPI._channel = channel;
            }
            else
            {
                Twitch.TwitchAPI._channel = File.ReadAllText("Channel.JOIN");
            }

            IRCClient.Start(HandleUserCommands, Twitch.TwitchAPI._channel);

            TwitchAPI.Init();
            VoteSystem.Init();
            UserManager.Init();
            IRCClient.Init(ConsoleWrite);
            MemorySystem._instance.Init();
            Microphone.Init();

            IRCMessage message = new IRCMessage();

            message.userName = userName;
            message.channel  = Twitch.TwitchAPI._channel;
            while (true)
            {
                try
                {
                    var writeMessage = Console.ReadLine();
                    if (writeMessage?.Trim() == "q")
                    {
                        break;
                    }
                    if (writeMessage?.Trim() != string.Empty)
                    {
                        IRCClient.SendIRCMessage(writeMessage);
                        message.message = writeMessage;
                        HandleUserCommands(message);

                        //System Only Commands
                        IRCClient.HandleMessages(message);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.ToString());
                }
            }
        }