import asyncio
import subprocess
from colorama import init, Fore
import time
import keyboard
import cv2
import sys
init()
print(f'{Fore.RED}██████╗░██╗░██████╗░█████╗░░█████╗░██████╗░██████╗░ ██████╗░░█████╗░████████╗')
time.sleep(0.1)
print(f'██╔══██╗██║██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗╚══██╔══╝')
time.sleep(0.1)
print(f'██║░░██║██║╚█████╗░██║░░╚═╝██║░░██║██████╔╝██║░░██║ ██████╦╝██║░░██║░░░██║░░░')
time.sleep(0.1)
print(f'██║░░██║██║░╚═══██╗██║░░██╗██║░░██║██╔══██╗██║░░██║ ██╔══██╗██║░░██║░░░██║░░░')
time.sleep(0.1)
print(f'██████╔╝██║██████╔╝╚█████╔╝╚█████╔╝██║░░██║██████╔╝ ██████╦╝╚█████╔╝░░░██║░░░')
time.sleep(0.1)
print(f'╚═════╝░╚═╝╚═════╝░░╚════╝░░╚════╝░╚═╝░░╚═╝╚═════╝░ ╚═════╝░░╚════╝░░░░╚═╝░░░')
time.sleep(0.1)
print()
time.sleep(0.1)
print()
time.sleep(0.1)
print()
print(f'░█████╗░██████╗░███████╗░█████╗░████████╗░█████╗░██████╗░ ██████╗░██╗░░░██╗████████╗██╗░░██╗░█████╗░███╗░░██╗')
time.sleep(0.1)
print(f'██╔══██╗██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗ ██╔══██╗╚██╗░██╔╝╚══██╔══╝██║░░██║██╔══██╗████╗░██║')
time.sleep(0.1)
print(f'██║░░╚═╝██████╔╝█████╗░░███████║░░░██║░░░██║░░██║██████╔╝ ██████╔╝░╚████╔╝░░░░██║░░░███████║██║░░██║██╔██╗██║')
time.sleep(0.1)
print(f'██║░░╚═╝██████╔╝█████╗░░███████║░░░██║░░░██║░░██║██████╔╝ ██████╔╝░╚████╔╝░░░░██║░░░███████║██║░░██║██╔██╗██║')
time.sleep(0.1)
print(f'██║░░╚═╝██████╔╝█████╗░░███████║░░░██║░░░██║░░██║██████╔╝ ██████╔╝░╚████╔╝░░░░██║░░░███████║██║░░██║██╔██╗██║')
time.sleep(0.1)
print(f'╚█████╔╝██║░░██║███████╗██║░░██║░░░██║░░░╚█████╔╝██║░░██║ ██║░░░░░░░░██║░░░░░░██║░░░██║░░██║╚█████╔╝██║░╚███║')
time.sleep(0.1)
print(f'░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝ ╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚══╝{Fore.RESET}')
time.sleep(0.1)
print('█▄▄ █▄█ █▀█ ▄▀█ █░█ █▀▀ █░░ █▀ █▀ █▀ █▀█ █▀█')
print('█▄█ ░█░ █▀▀ █▀█ ▀▄▀ ██▄ █▄▄ ▄█ ▄█ ▄█ ▀▀█ █▄█')
create = input('Введите токен: ')
'''
@bot.event
async def on_ready():
print('Bot ready')
# while True:
game = discord.Game("/help и меня писал Павел")
await bot.change_presence(status=discord.Status.idle, activity=game)'''
with open('main.py', 'w+', encoding='utf-8') as f:
f.write(f'import discord\nfrom discord import utils\nfrom discord.utils import get\nfrom discord.ext import commands\n\nclient = commands.Bot( command_prefix = "!")\n\n\n@client.event\nasync def on_ready():\n\tprint("Бот запущен")\n\n\n\nclient.run("{create}")')
time.sleep(1)
p = subprocess.Popen('python3 main.py')
print('Нажмите ctrl+shift для завершения работы')
def callback():
p.terminate()
print('Забершена работа програмы')
keyboard.remove_hotkey('ctrl+shift')
maincode()
keyboard.add_hotkey('ctrl+shift', callback)
def maincode():
ch = int(input('Что вы хотите сделать?\n(1)Запустить\n(2)Выйти '))
print(ch)
if ch == 1:
p = subprocess.Popen('python3 main.py')
print('Нажмите ctrl+shift для завершения работы')
keyboard.add_hotkey('ctrl+shift', callback)
elif ch == 2:
print('Досвидание. Буду рад видеть вас снова')
sys.exit()
else:
maincode()
И мне в лицо прилетает ошибка
Что вы хотите сделать?
(1)Запустить
(2)Выйти Exception in thread Thread-13:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\b0tbo\AppData\Roaming\Python\Python39\site-packages\keyboard\_generic.py", line 58, in process
if self.pre_process_event(event):
File "C:\Users\b0tbo\AppData\Roaming\Python\Python39\site-packages\keyboard\__init__.py", line 218, in pre_process_event
callback(event)
File "C:\Users\b0tbo\AppData\Roaming\Python\Python39\site-packages\keyboard\__init__.py", line 649, in <lambda>
handler = lambda e: (event_type == KEY_DOWN and e.event_type == KEY_UP and e.scan_code in _logically_pressed_keys) or (event_type == e.event_type and callback())
File "C:/Users/b0tbo/Desktop/bot creator/app.py", line 64, in callback
maincode()
File "C:/Users/b0tbo/Desktop/bot creator/app.py", line 69, in maincode
ch = int(input('Что вы хотите сделать?\n(1)Запустить\n(2)Выйти '))
ValueError: invalid literal for int() with base 10: ''
Я понимаю что она значит но никак не пойму как её решить