├── .gitignore ├── INSTALL.bat ├── README.md ├── START.bat ├── main.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | *.log 3 | test.py -------------------------------------------------------------------------------- /INSTALL.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Creating virtual environment... 4 | python -m venv venv 5 | 6 | echo Activating virtual environment... 7 | call venv\Scripts\activate 8 | 9 | echo Installing dependencies... 10 | pip install -r requirements.txt 11 | 12 | echo Installation done 13 | pause -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://www.python.org/downloads/) 2 | 3 | # [MemHashAuto](https://t.me/memhash_bot) 4 | 5 | > [!NOTE] 6 | > Support only Windows for now 7 | 8 | 9 | ## ⚡ Features 10 | 1. Auto start when energy is full 11 | 12 | 13 | ## ⚡ Quick Start 14 | 1. To install the libraries on Windows, run `INSTALL.bat`. 15 | 2. To start the bot, use `START.bat` (or in the console: python main.py). 16 | 17 | 18 | ## 📌 Prerequisites 19 | Before you start, make sure you have the following installed: 20 | - [Python](https://www.python.org/downloads/) version 3.10 or 3.11. 21 | 22 | 23 | ## 🧱 Installation 24 | You can clone the [**Repository**](https://github.com/qt333/MemHashAuto) to your system and installing the required dependencies: 25 | ```cmd 26 | ~ >>> git clone https://github.com/qt333/MemHashAuto.git 27 | ~ >>> cd MemHashAuto 28 | 29 | # Windows 30 | ~/MemHashAuto >>> python -m venv venv 31 | ~/MemHashAuto >>> venv\Scripts\activate 32 | ~/MemHashAuto >>> pip install -r requirements.txt 33 | ~/MemHashAuto >>> python main.py 34 | ``` 35 | 36 | ## Donation 37 | USDT/DOGS/HMSTR/NOT (TON): UQD9bAZ5I8w2iqBJfNmv3Lpezm-2HfYMoDQVWQOo7AXodNyf 38 | -------------------------------------------------------------------------------- /START.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Activating virtual environment... 3 | call venv\Scripts\activate 4 | echo Starting the bot... 5 | python main.py 6 | pause -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import time 3 | import pygetwindow as pg 4 | import random 5 | from art import text2art 6 | from colorama import init 7 | from termcolor import colored 8 | import ctypes 9 | import random 10 | import sys 11 | from math import ceil 12 | from loguru import logger 13 | 14 | def logging_setup(): 15 | format_info = "{time:HH:mm:ss.SS} | {level} | {message}" 16 | logger.remove() 17 | 18 | logger.add(sys.stdout, colorize=True, format=format_info, level="INFO") 19 | logger.add("memhash.log", rotation="50 MB", compression="zip", format=format_info, level="TRACE") 20 | # if config.USE_TG_BOT: 21 | # logger.add(lambda msg: send_log_to_telegram(msg), format="{time:YYYY-MM-DD HH:mm:ss} | {level} | {message}", level="INFO") 22 | 23 | logging_setup() 24 | 25 | def script_info(name: str = "MemHashAuto"): 26 | init() 27 | print(colored(text2art('MemHashAuto'), "green")) 28 | 29 | if sys.platform == 'win32': 30 | ctypes.windll.kernel32.SetConsoleTitleW(f"{name}") 31 | 32 | print( 33 | f"{colored('Github: https://github.com/qt333/', color='light_yellow')}\n" 34 | f"{colored('Donate (TON): UQD9bAZ5I8w2iqBJfNmv3Lpezm-2HfYMoDQVWQOo7AXodNyf', color='light_green')}" 35 | ) 36 | 37 | def get_window(): 38 | """ 39 | Get the blum window. 40 | 41 | :return: The blum window 42 | """ 43 | windows = next( 44 | ( 45 | pg.getWindowsWithTitle(opt) 46 | for opt in ["TelegramDesktop", "64Gram", "AyuGram", "telegram-desktop"] 47 | if pg.getWindowsWithTitle(opt) 48 | ), 49 | None, 50 | ) 51 | 52 | window = windows[0] if windows else None 53 | 54 | if window and not window.isActive: 55 | # window.minimize() 56 | window.restore() 57 | 58 | return window 59 | elif window.isActive: 60 | return window 61 | 62 | return None 63 | 64 | def get_rect(window): 65 | """ 66 | Get the rectangle coordinates of the given window. 67 | 68 | :param window: The window object 69 | :return: A tuple containing the coordinates (left, top, width, height) 70 | """ 71 | return (window.left, window.top, window.width, window.height) 72 | 73 | def click_start_button(screen, rect): 74 | time.sleep(random.random()) 75 | width, height = screen.size 76 | screen_x = rect[0] + ceil(width * 0.485) 77 | screen_y = rect[1] + ceil(height * 0.6502) 78 | pyautogui.click( 79 | screen_x + random.randint(1,10), 80 | screen_y + random.randint(1,10), button='LEFT' 81 | ) 82 | 83 | def detected_low_energy_status(screen, rect): 84 | width, height = screen.size 85 | screen_x = rect[0] + ceil(width * 0.4253) 86 | screen_y = rect[1] + ceil(height * 0.5056) 87 | R, G, B = pyautogui.pixel(screen_x, screen_y) 88 | red_range = (R > 220) and (90 <= G < 121) and (90 <= B < 113) 89 | return red_range 90 | 91 | def detected_full_energy_status(screen, rect): 92 | width, height = screen.size 93 | # full_energy_color = (175, 253, 181) 94 | screen_x = rect[0] + ceil(width * 0.5945) 95 | screen_y = rect[1] + ceil(height * 0.2289) 96 | R, G, B = pyautogui.pixel(screen_x, screen_y) 97 | # if full_energy_color == (R, G, B): 98 | energy_range = (130 <= R <= 220) and (150 <= G <= 255) and (150 <= B <= 255) 99 | if energy_range: 100 | return True 101 | else: 102 | return False 103 | 104 | def detected_partial_energy_status(screen, rect, step): 105 | width, height = screen.size 106 | # full_energy_color = (175, 253, 181) 107 | # partial_energy_color = (159, 179, 241) #blue 108 | # partial_energy_color = (177, 183, 253) #blue 109 | #(140, 175, 229) blue3 110 | screen_x = rect[0] + ceil(width * 0.5945) - step 111 | screen_y = rect[1] + ceil(height * 0.2289) 112 | R, G, B = pyautogui.pixel(screen_x, screen_y) 113 | # blue_range_0 = (150 <= R <= 180) and (170 <= G < 190) and (230 <= B <= 255) 114 | # blue_range_1 = (170 <= R <= 190) and (170 <= G < 220) and (200 <= B <= 235) 115 | energy_range = (130 <= R <= 220) and (150 <= G <= 255) and (150 <= B <= 255) 116 | # print(screen_x, screen_y, (R, G, B)) 117 | if energy_range: 118 | return True 119 | else: 120 | return False 121 | 122 | def capture_screenshot(rect): 123 | """ 124 | Capture a screenshot of the specified region. 125 | 126 | :param rect: A tuple containing the region coordinates (left, top, width, height) 127 | :return: A screenshot image of the specified region 128 | """ 129 | return pyautogui.screenshot(region=rect) 130 | 131 | def main(): 132 | 133 | script_info() 134 | 135 | cycle = 0 136 | c = 0 137 | status_mining = False 138 | # button_start_coord = (195, 463) 139 | # energy_status_pixel_coord = (171, 360) 140 | # full_energy_pixel_coord = (239, 163) 141 | # full_energy_color = (175, 253, 181) #green 142 | window = get_window() 143 | if not window: 144 | logger.info(f"{colored('Window not found!', color='red')}") 145 | return 146 | logger.info(f"{colored(f'Window found {window.title}!', color='white')}") 147 | logger.info(f"{colored(f'Mining will start automatically in a few seconds!', color='white')}") 148 | rect = get_rect(window) 149 | screenshot = capture_screenshot(rect) 150 | try: 151 | time.sleep(3) 152 | #initial cycle 153 | while True: 154 | window = get_window() 155 | if window: 156 | rect = get_rect(window) 157 | # if detected_full_energy_status(screenshot, rect, full_energy_pixel_coord): 158 | #NOTE search for energy pixel at 1st cycle. All other cycles will be proceed with full energy bar! 159 | if not cycle and not detected_low_energy_status(screenshot, rect): 160 | for step in range(0, 111, 2): 161 | if detected_partial_energy_status(screenshot , rect, step): 162 | click_start_button(screenshot, rect) 163 | cycle += 1 164 | logger.info(f'Started | Starting mining №{cycle}') 165 | break 166 | time.sleep(0.05) 167 | if detected_low_energy_status(screenshot, rect): 168 | time.sleep(0.1) 169 | click_start_button(screenshot, rect) 170 | logger.info('Stopped | Waiting for energy restore...') 171 | break #exit from initial cycle 172 | else: 173 | logger.info(f"{colored('Window not found!', color='red')}") 174 | return 175 | time.sleep(10) 176 | 177 | while True: 178 | window = get_window() 179 | if window: 180 | rect = get_rect(window) 181 | #start mining when energy bar is full 182 | if detected_full_energy_status(screenshot, rect): 183 | cycle += 1 184 | status_mining = True 185 | logger.info(f'Mining | Starting mining cycle №{cycle}') 186 | time.sleep(random.uniform(1,3)) 187 | click_start_button(screenshot, rect) 188 | #stop mining when status low energy 189 | if detected_low_energy_status(screenshot, rect): 190 | click_start_button(screenshot, rect) 191 | status_mining = False 192 | logger.info('Stopped | Waiting for energy restore...') 193 | else: 194 | logger.info(f"{colored('Window not found!', color='red')}") 195 | return 196 | time.sleep(30) 197 | #printing every 5 minutes that script wait for enegry restore 198 | if not (c % 10) and not status_mining: 199 | logger.info(f'Resting | Waiting for energy restore...') 200 | c += 1 201 | except KeyboardInterrupt: 202 | logger.info("Process interrupted. Exiting...") 203 | sys.exit(0) 204 | 205 | if __name__ == "__main__": 206 | main() -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyautogui 2 | pygetwindow 3 | termcolor 4 | art 5 | colorama 6 | loguru --------------------------------------------------------------------------------