28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
if __name__ == '__main__':
|
|
import os, sys, event, bot
|
|
from multiprocessing import Process
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
import models.logger
|
|
# Reuse the interpreter that launched this process. Calling ``uv`` from
|
|
# a child shell breaks when uv was installed outside PATH (and also makes
|
|
# ``uv run main.py`` recurse through a second environment).
|
|
CMD = 'python3.13.exe' if sys.platform == 'win32' else f'"{sys.executable}"'
|
|
PROCESSES = [
|
|
Process(target=bot.run if sys.platform == 'win32' else os.system, args=() if sys.platform == 'win32' else (f'{CMD} -c "import bot; bot.run()"',)),
|
|
# Process(target=bot.run),
|
|
Process(target=event.run),
|
|
]
|
|
|
|
os.system('cls' if sys.platform == 'win32' else 'clear')
|
|
models.logger.log('Main', 'Startup...')
|
|
try:
|
|
[process.start() for process in PROCESSES]
|
|
[process.join() for process in PROCESSES]
|
|
|
|
except KeyboardInterrupt:
|
|
[process.terminate() for process in PROCESSES]
|
|
[process.join() for process in PROCESSES]
|
|
|
|
except Exception as e:
|
|
models.logger.error('Main', f'{e}')
|