-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
61 lines (41 loc) · 1.24 KB
/
main.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
from sys import argv
from time import sleep
from pyautogui import click, locateOnScreen, locateAllOnScreen, scroll
def follow() -> None:
running = 0
while running < 5:
locations = list(locateAllOnScreen(
'./img/follow.png', confidence=0.8))
if not locations:
running += 1
for location in locations:
click(location)
sleep(1)
scroll(-200)
def unfollow() -> None:
running = 0
while running < 5:
locations = list(locateAllOnScreen(
'./img/unfollow.png', confidence=0.85))
if not locations:
running += 1
for location in locations:
click(location)
sleep(1)
click(locateOnScreen('./img/confirm.png', confidence=0.9))
sleep(1)
scroll(-200)
def main():
if argv[1] == 'follow':
follow()
elif argv[1] == 'unfollow':
unfollow()
else:
print("Wrong argument (follow/unfollow).\nRead the README for more information.")
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
except IndexError:
print("Missing argument (follow/unfollow).\nRead the README for more information.")