So I'm trying to write a spam bot to annoy my friends in discord (I know I'm evil) Here's the code
import time
import pyautogui
time.sleep(10)
victim = "Saka"
f = open("spamtext", 'r')
for word in f:
pyautogui.keyUp('shift')
pyautogui.typewrite("@" + victim)
pyautogui.press("enter")
time.sleep(1)
The problem is, instead of typing "@Saka", it types "`Saka".
I've tried pyautogui.keyUp('shift')
, but it still doesn't work,any ideas?
(Also this is my first time asking a question here, so sorry if I didn't provide enough info)
Lol! This is a funny post. Cheers to the prank.
With pyautogui, it literally presses the keyboard. Imagine a human robot doing it really fast. So you need to pass the exact keys you press in your keyboard to output the "@"
In order to do this, the función hotkey is available.
To make pressing hotkeys or keyboard shortcuts convenient, the hotkey() can be passed several key strings which will be pressed down in order, and then released in reverse order.
In my keyboard, I can output an @symbol with shift + 2 which I think it would be something like:
pyautogui.hotkey('shift', '2')