with open('midas_bot.py', 'r', encoding='utf-8') as f:
    content = f.read()

import re

target_regex = r"browser = await p\.chromium\.launch\(headless=False, channel='chrome', slow_mo=80\)"
new_code = """try:
            browser = await p.chromium.launch(headless=False, channel='chrome', slow_mo=80)
        except Exception:
            try:
                browser = await p.chromium.launch(headless=False, channel='msedge', slow_mo=80)
            except Exception:
                browser = await p.chromium.launch(headless=False, slow_mo=80)"""

content = re.sub(target_regex, new_code, content)

with open('midas_bot.py', 'w', encoding='utf-8') as f:
    f.write(content)
print("TARAYICI GUVENCESI EKLENDI!")
