public async Task ToggleAsync2()
        {
            for (var i = 0; i < 5; i++)
            {
                var Before = KeyboardState.Current()[KeyCode.LShift];

                if (Before != KeyboardKeyState.Default)
                {
                    await Simulate.Events().Release(KeyCode.LShift).Invoke();
                }
                else
                {
                    await Simulate.Events().Hold(KeyCode.LShift).Invoke();
                }

                var After1 = KeyboardState.Current()[KeyCode.LShift];
                var After2 = KeyboardState.Current()[KeyCode.LShift];

                Console.WriteLine($@"Test {i}");
                Console.WriteLine($@"Before: {Before}");
                Console.WriteLine($@"After1: {After1}");
                Console.WriteLine($@"After2: {After2}");
                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        public async void CloseZoom()
        {
            SetForegroundWindow(parentWH);
            SetFocus(parentWH);
            await Simulate.Events().ClickChord(KeyCode.Menu, KeyCode.Q).Wait(200).ClickChord(KeyCode.Return).Invoke();

            DestroyWindow(parentWH);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes the item.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="KeyboardMessageEventArgs" /> instance containing the event data.</param>
        private async void DeleteItem(object sender, KeyboardMessageEventArgs e)
        {
            if (this._settingsService.DeleteItemEnabled)
            {
                await Simulate.Events().Click(WindowsInput.Events.ButtonCode.Left).Invoke();

                await this._keyboardHelper.Destroy();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Writes the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns>The task awaiter.</returns>
        public async Task Write(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            await Simulate.Events().Click(text).Invoke();
        }
Ejemplo n.º 5
0
        public static async void Login(IWebElement element, IWebDriver driver, string gmail, string password)
        {
            element = driver.FindElement(By.XPath("/html/body/div/div[1]/div/div[2]/div/form/div/div/div[1]/div[3]/div[1]/div/input")); // Username / Gmail Box Element
            element.Click();
            element.SendKeys(gmail);                                                                                                    // Username / Gamil
            await Simulate.Events().Wait(1000).Invoke();                                                                                // Wait 1 second

            element = driver.FindElement(By.XPath("/html/body/div/div[1]/div/div[2]/div/form/div/div/div[1]/div[3]/div[2]/div/input")); // Password Box Element
            element.Click();
            element.SendKeys(password);                                                                                                 // Password
            element.Submit();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Simulates a search using Ctrl+F.
        /// </summary>
        /// <param name="searchTerm">The search term to use.</param>
        /// <returns>The task awaiter.</returns>
        public async Task Search(string searchTerm)
        {
            await Simulate.Events().Click(KeyCode.LMenu).Invoke();

            Native.SetForegroundWindow(this._windowHandle);

            var eventBuilder = Simulate.Events();

            eventBuilder.ClickChord(KeyCode.LControl, KeyCode.F);
            eventBuilder.Click(searchTerm);
            eventBuilder.Click(KeyCode.Return);
            await eventBuilder.Invoke();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the item in clipboard.
        /// </summary>
        /// <returns>The item in the clipboard.</returns>
        public static async Task <PoeItem> GetItemInClipboard()
        {
            try
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.Control, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(100);

                return(ItemParser.Parse(GetClipboardText()));
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Gets the item base type in clipboard.
        /// </summary>
        /// <returns>The item search value.</returns>
        private async Task <string> GetItemSearchValueInClipboard()
        {
            try
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.Control, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(50);

                var text = ClipboardHelper.GetClipboardText();
                ClipboardHelper.ClearClipboard();

                return(this._itemParser.GetSearchValue(text));
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 9
0
        public override void StartAction()
        {
            string       keys         = Model.Keys;
            EventBuilder eventBuilder = Simulate.Events();

            string[] events = keys.Split('|');
            foreach (string keyEvent in events)
            {
                if (keyEvent.StartsWith('(') && keyEvent.EndsWith(")"))
                {
                    eventBuilder.ClickChord(ParseChord(keyEvent));
                }
                else
                {
                    eventBuilder.Click(keyEvent.Trim('\''));
                }
            }

            eventBuilder.Invoke();
        }
        public async Task HugeInput()
        {
            var Text = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\n";
            var SB   = new StringBuilder();

            for (int i = 0; i < 1000; i++)
            {
                SB.Append(Text);
            }


            var sim = Simulate.Events()
                      .ClickChord(KeyCode.LWin, KeyCode.R)
                      .Wait(1000)
                      .Click("notepad")
                      .Wait(1000)
                      .Click(KeyCode.Return)
                      .Wait(1000)
                      .Click(SB.ToString())
            ;

            await sim.Invoke();
        }
        static async Task Main()
        {
            var bot         = new ClientSideDiscordBot.Program();
            var gmail       = ClientSideDiscordBot.Program.gmail;
            var password    = ClientSideDiscordBot.Program.password;
            var discordLink = bot.discordBegLink;

            var options = new ChromeOptions();

            options.AddArguments("--headless");

            using (IWebDriver driver = new ChromeDriver(options))
            {
                driver.Navigate().GoToUrl(discordLink.ToString());
                await Simulate.Events().Wait(1000).Invoke();

                if (driver.Url != discordLink.ToString())
                {
                    ClientSideDiscordBot.Program.Login(element, driver, gmail, password);
                }

                await Simulate.Events().Wait(6200).Invoke(); // Waits 6.2 seconds

                if (driver.Url == discordLink.ToString())
                {
                    while (true) // Loops the send method
                    {
                        // Send Bar element
                        var sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                        sendbar.Click();
                        sendbar.SendKeys("pls beg");
                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                        await Simulate.Events().Wait(30000).Invoke();
                    }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Sends the command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns>
        /// The task awaiter.
        /// </returns>
        protected async Task SendCommand(string command)
        {
            // This is to fix the first SetForegroundWindow
            await Simulate.Events().Click(KeyCode.LMenu).Invoke();

            Native.SetForegroundWindow(this._windowHandle);
            await Task.Delay(10);

            var foregroundWindow = Native.GetForegroundWindow();

            if (this._windowHandle != foregroundWindow)
            {
                await Task.Delay(100);
            }

            var eventBuilder = Simulate.Events();

            eventBuilder.Click(KeyCode.Return);
            eventBuilder.ClickChord(KeyCode.LControl, KeyCode.A);
            eventBuilder.Click(command);
            eventBuilder.Click(KeyCode.Return);

            await eventBuilder.Invoke();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async Task ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.LControlKey, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(100);

                item = ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }
        public async Task SayHello()
        {
            var sim = Simulate.Events()
                      .ClickChord(KeyCode.LWin, KeyCode.R)
                      .Wait(1000)
                      .Click("notepad")
                      .Wait(1000)
                      .Click(KeyCode.Return)
                      .Wait(1000)
                      .Click("These are your orders if you choose to accept them...")
                      .Click("This message will self destruct in 5 seconds.")
                      .Wait(5000)
                      .Click(KeyCode.Alt, KeyCode.Space)
                      .Click(KeyCode.Down)
                      .Click(KeyCode.Return)
            ;


            for (int i = 0; i < 10; i++)
            {
                sim
                .Click(KeyCode.Down)
                .Wait(100)
                ;
            }


            sim
            .Click(KeyCode.Return)
            .Wait(1000)
            .ClickChord(KeyCode.Alt, KeyCode.F4)
            .Click(KeyCode.N)
            ;

            await sim.Invoke();
        }
Ejemplo n.º 15
0
        static async Task Main()
        {
            var start = true;

            var rand         = new Random();
            var correctGuess = rand.Next(1, 11);

            var discordLink      = @"https://discordapp.com/channels/676916182653206548/686009518639153152";      // main discord link
            var discordCountLink = @"https://discordapp.com/channels/676916182653206548/686786013154115654";      // the count link for the command ;count

            var restart = @"F:\VSRepos\VSStudio\C#\ClientSideDiscordBot\bin\Debug\" + "ClientSideDiscordBot.exe"; // Path for discord bot
            var plsbeg  = @"F:\VSRepos\VSStudio\C#\ClientSideDiscordBot\bin\Debug\" + "plsbeg.exe";               // path for beg bot

            var options = new ChromeOptions();

            options.AddArguments("--headless");

            using (IWebDriver driver = new ChromeDriver(options))
            {
                driver.Navigate().GoToUrl(discordLink.ToString());
                await Simulate.Events().Wait(1000).Invoke();

                if (driver.Url != discordLink.ToString())
                {
                    Login(element, driver, gmail, password);
                }

                await Simulate.Events().Wait(6200).Invoke(); // Wait 6.2 seconds, not needed but used for releasing stress on CPU

                if (driver.Url == discordLink.ToString() || driver.Url == discordCountLink.ToString())
                {
                    while (start)
                    {
                        try
                        {
                            // Message Box Container
                            element = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > div.messagesWrapper-3lZDfY.group-spacing-16 > div > div"));
                            // Messages in the message box
                            var elementCount = element.FindElements(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > div.messagesWrapper-3lZDfY.group-spacing-16 > div > div > div"));
                            // Send Bar element
                            var sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));

                            for (int i = elementCount.Count; i < elementCount.Count + 1; i++) // Takes the element count and gets the newest messgae
                            {
                                // The newest messages in a loop
                                element = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > div.messagesWrapper-3lZDfY.group-spacing-16 > div > div > div:nth-child(" + i.ToString() + ")"));

                                try
                                {
                                    // Taking the inner text of the elements
                                    var commands = element.Text.ToString();

                                    if (commands.Contains(";cmds") || commands.Contains(";help"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Commands: ");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter); // Makes a new line in discord

                                        sendbar.SendKeys("Remove spaces to execute commands! ");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; test // This command anyone can use!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        /*sendBar.SendKeys("; start begbot // this only work for the main users acc!");
                                         * sendBar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);
                                         *
                                         * sendBar.SendKeys("; stop begbot // this only works for the main users acc!");
                                         * sendBar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);*/

                                        sendbar.SendKeys("; ping // this works for anyone *pings the user*");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; date // this works for anyone shows the date");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; restart // this works for anyone restarts the bot");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; game (guessNumber) - 1-10 // this works for anyone starts game to put my pc to sleep gl!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; msg (message) // this works for anyone prints out a custom message");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.LeftShift + OpenQA.Selenium.Keys.Enter);

                                        sendbar.SendKeys("; count Min, Max // this works for anyone switches to the counting channel and counts");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";test"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Test");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";start begbot"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("BOT: Beg Bot Started");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                        Process.Start(plsbeg); // Starts the beg bot process
                                    }

                                    if (commands.Contains(";stop begbot"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("BOT: Beg Bot Stopped");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                        ProcessID.EndProcess(@"plsbeg"); // Ends the process
                                    }

                                    if (commands.Contains(";withdraw"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("pls share @Xenial.-#6404 250");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";ping"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("BOT: PINGED");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                        Console.Beep(); // Uses the console to send a beep noise to the hosts pc
                                    }

                                    if (commands.Contains(";date"))
                                    {
                                        var time = DateTime.Today.ToLongDateString();
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys(time.ToString());
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";ans")) // Gets the answer for the game
                                    {
                                        Console.WriteLine("Answer: " + correctGuess);
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Ans printed to console!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";msg"))                             // Sends back user messages
                                    {
                                        var msg = commands.Substring(commands.IndexOf((";"))); // Starts a new string at the index of ; << /0
                                        msg = msg.Remove(0, 5);                                // removes the ;msg + the space

                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Sending!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                        sendbar.Click();
                                        sendbar.SendKeys(msg); // Sends the new string out to the user
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);
                                    }

                                    if (commands.Contains(";count"))
                                    {
                                        var msg = commands.Substring(commands.IndexOf((";"))); // Starts a new string at the index of ; << /0
                                        msg = msg.Remove(0, 7);                                // removes the ;count + the space

                                        // Starts at the other side of the number and removes the rest of the string
                                        var minNum = int.Parse(msg.Remove(msg.IndexOf(","), commands.Substring(commands.IndexOf(",")).Length));

                                        msg = commands.Substring(commands.IndexOf(",")); // Starts a new string at the index of , << /0
                                        var maxNum = int.Parse(msg.Remove(0, 2));        // Removes the space and only uses the numbers in the string

                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Counting!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                        driver.Navigate().GoToUrl(discordCountLink.ToString()); // It first goes to the counting channel in the discord then begins counting

                                        if (driver.Url == discordCountLink.ToString())          // Only works if its in the Counting Channel
                                        {
                                            await Simulate.Events().Wait(4000).Invoke();        // Waits 4 secs to make sure the site is fully loaded

                                            for (int x = minNum; x < maxNum + 1; x++)
                                            {
                                                sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                                sendbar.Click();
                                                sendbar.SendKeys(x.ToString());
                                                sendbar.SendKeys(OpenQA.Selenium.Keys.Enter);
                                                await Simulate.Events().Wait(800).Invoke();
                                            }

                                            driver.Navigate().GoToUrl(discordLink.ToString()); // Once it ends it goes back to the main discord channel
                                        }
                                    }

                                    if (commands.Contains(";game"))
                                    {
                                        if (commands.Contains(";game " + correctGuess))
                                        {
                                            sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                            sendbar.Click();
                                            sendbar.SendKeys("Correct!");
                                            sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                            correctGuess = rand.Next(1, 11);
                                            Sleep();
                                            break;
                                        }
                                        else
                                        {
                                            sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                            sendbar.Click();
                                            sendbar.SendKeys("Wrong! Game Ended");
                                            sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                            correctGuess = rand.Next(1, 11);
                                            break;
                                        }
                                    }

                                    if (commands.Contains(";restart"))
                                    {
                                        sendbar = driver.FindElement(By.CssSelector(@"#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > div > div.content-98HsJk > div.chat-3bRxxu > div.content-yTz4x3 > div.chatContent-a9vAAp > form > div > div > div > div.textArea-12jD-V.textAreaSlate-1ZzRVj.slateContainer-3Qkn2x > div.markup-2BOw-j.slateTextArea-1Mkdgw.fontSize16Padding-3Wk7zP"));
                                        sendbar.Click();
                                        sendbar.SendKeys("Restarting Bot!");
                                        sendbar.SendKeys(OpenQA.Selenium.Keys.Return);

                                        Process.Start(restart);                       // Starts a new process of the bot
                                        ProcessID.EndProcess("ClientSideDiscordBot"); // Ends the old process
                                    }
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Error");
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Failed");
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Simulate the events contained within this <see cref="EventBuilder"/>
 /// </summary>
 /// <param name="Options">Options that control the flow of these events</param>
 /// <returns></returns>
 public Task <bool> Invoke(InvokeOptions?Options = default)
 {
     return(Simulate.Events(Options, Events.ToList()));
 }
Ejemplo n.º 17
0
 protected sealed override Task <bool> Invoke(InvokeOptions Options)
 {
     return(Simulate.Events(Options, Children));
 }
Ejemplo n.º 18
0
 static void Main(string[] args)
 {
     Task.Delay(1000).Wait();
     Simulate.Events().Hold(KeyCode.S).Wait(1000).Release(KeyCode.S).Invoke().Wait();
     Console.ReadLine();
 }