-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
89 lines (76 loc) · 2.49 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import time
import datetime
from threading import Thread
from pynput.mouse import Button, Controller
from pynput.keyboard import Listener, KeyCode, Controller as Kontroller
button = Button.left
start_stop_key = KeyCode(char="s")
exit_key = KeyCode(char="x")
reset_key = KeyCode(char="r")
class ClickMouse(Thread):
def __init__(self, button, keyboard):
super(ClickMouse, self).__init__()
self.button = button
self.keyboard = keyboard
self.running = False
self.program_running = True
self.counter = 7200
def start_clicking(self):
self.running = True
keyboard.press("m")
keyboard.press("e")
keyboard.press("i")
keyboard.press("o")
def stop_clicking(self):
self.running = False
keyboard.release("m")
keyboard.release("e")
keyboard.release("i")
keyboard.release("o")
def reset(self):
self.counter = 7200
def exit(self):
self.stop_clicking()
self.program_running = False
keyboard.release("m")
keyboard.release("e")
keyboard.release("i")
keyboard.release("o")
def run(self):
while self.program_running:
while self.running:
mouse.click(self.button)
time.sleep(0.1)
self.counter = self.counter + 1
if self.counter >= 7200:
keyboard.press("p")
time.sleep(0.5)
keyboard.release("p")
keyboard.press("q")
time.sleep(0.5)
keyboard.release("q")
self.counter = 0
print ("Prestige at: " +
datetime.datetime.now().strftime("%H:%M:%S"))
time.sleep(0.1)
mouse = Controller()
keyboard = Kontroller()
click_thread = ClickMouse(button, keyboard)
click_thread.start()
def on_press(key):
if key == start_stop_key:
if click_thread.running:
click_thread.stop_clicking()
print("Paused")
else:
click_thread.start_clicking()
print("Started")
elif key == reset_key:
click_thread.reset()
print("Reset")
elif key == exit_key:
click_thread.exit()
listener.stop()
print("Stopped")
with Listener(on_press=on_press) as listener:
listener.join()