From bb060359004113bf9728ad8e8fec9270d6f30f61 Mon Sep 17 00:00:00 2001 From: def <8384198-dettlaff@users.noreply.gitlab.com> Date: Wed, 1 Dec 2021 20:34:58 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autogames/tg.py | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 autogames/tg.py diff --git a/autogames/tg.py b/autogames/tg.py new file mode 100644 index 0000000..b14c28f --- /dev/null +++ b/autogames/tg.py @@ -0,0 +1,68 @@ +from PIL import ImageGrab +import time +import os + +from pynput.keyboard import Key, Controller + + +command = ["left", "left", "left"] + +def do(): + + global add + + image = ImageGrab.grab() #(863, 751, 1091, 767)) + print("Screenshot №" + str(i)) + + # restart = image.getpixel((1037, 988)) + # if restart == (47, 238, 186): + # from pynput.mouse import Button, Controller + # mouse = Controller() + # print("RESTART!") + # command = ["left", "left", "left"] + # return + + + + + color = image.getpixel((928, 491)) + if color == (167, 92, 42) or color == (129, 113, 130): + + add = "right" + return add + + color2 = image.getpixel((989, 492)) + if color2 == (167, 92, 42) or color == (129, 113, 130): + + add = "left" + return add + + else: + print('skip') + add = "left" + return add + +keyboard = Controller() +time.sleep(2) +for i in range(9999999999999999999999999999999999): + + + time.sleep(0.3) + + + if i % 2 == 0 or i == 0: + # print(i) + do() + + if command[i] == "left": + keyboard.press(Key.left) + keyboard.release(Key.left) + print('\033[31mGo left!\033[0m') + + if command[i] == "right": + keyboard.press(Key.right) + keyboard.release(Key.right) + print('\033[32mGo right!\033[0m') + + command.append(add) + # os.system("clear")