-
Notifications
You must be signed in to change notification settings - Fork 9
/
run.py
35 lines (29 loc) · 959 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import platform
import logging
from pyvirtualdisplay import Display
try:
from AppConstants import Constants as Constants
except ImportError:
from DefaultConstants import Constants as Constants
from utils.bot import build_bot
import colorlog
logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
handler = colorlog.StreamHandler()
handler.setFormatter(colorlog.ColoredFormatter(
'%(log_color)s%(bold)s%(levelname)s:%(name)s:%(message)s'))
handlers = [handler]
logging.basicConfig(level=Constants.OTHER_LIBRARIES_LOG_LEVEL, handlers=handlers)
if os.name != "nt":
import uvloop
uvloop.install()
if __name__ == "__main__":
if platform.system() == "Linux":
logger.info("Opening Display")
display = Display(visible=0, size=(1080,720))
display.start()
build_bot().run()
if platform.system() == "Linux":
logger.info("Closing Display")
display.stop()