Created add_keybind function.
This commit is contained in:
parent
2941857bcf
commit
3d20c3b5a9
|
|
@ -1,3 +1,4 @@
|
|||
from typing import Callable
|
||||
import pynput.keyboard as keyboard
|
||||
import pynput.mouse as mouse
|
||||
from secrets import randbelow
|
||||
|
|
@ -79,6 +80,18 @@ def full_setup():
|
|||
random_sleep_between(1_800, 2_200)
|
||||
k.tap('1')
|
||||
|
||||
def add_keybind(keybind: str | Key, action: Callable):
|
||||
def on_release(key):
|
||||
try:
|
||||
if key == keybind:
|
||||
action()
|
||||
else:
|
||||
if key.char == keybind:
|
||||
action()
|
||||
except:
|
||||
pass
|
||||
|
||||
random_sleep_between(2_000, 3_000)
|
||||
full_setup()
|
||||
keyboard.Listener(on_release=on_release).start()
|
||||
|
||||
while True:
|
||||
time.sleep(1000)
|
||||
Loading…
Reference in a new issue