title: How to speed up while loop with PyAutoGui?
body: <p>I am making a very simple spambot for Discord just for pranking my friends. But the while True: command is very slow. Is there a faster alternative?</p>
  <pre class="lang-py prettyprint-override"><code>import PIL
  import pyautogui, time
  time.sleep(5)
  pyautogui.FAILSAFE = True
  while True:
      pyautogui.hotkey(&quot;command&quot;, &quot;v&quot;)
      pyautogui.press(&quot;enter&quot;)
      
  if (pyautogui.locateOnScreen(&quot;av.png&quot;)):
      (pyautogui.click(pyautogui.locateCenterOnScreen(&quot;av.png&quot;)))
  </code></pre>