-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathghost.py
More file actions
executable file
·75 lines (59 loc) · 1.63 KB
/
ghost.py
File metadata and controls
executable file
·75 lines (59 loc) · 1.63 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os
import sys
import certifi
import multiprocessing
sys.setrecursionlimit(10000)
os.environ["SSL_CERT_FILE"] = certifi.where()
HEADLESS = "DISPLAY" not in os.environ and sys.platform == "linux"
if sys.platform == "darwin":
multiprocessing.set_start_method("fork", force=True)
if getattr(sys, 'frozen', False):
os.chdir(os.path.dirname(sys.executable))
from utils.files import get_application_support
from utils.config import Config
from utils import startup_check, check_fonts, console
from bot.controller import BotController
if not HEADLESS:
from gui.main import GhostGUI
from gui.font_check import FontCheckGUI
def run_gui():
cfg = Config()
controller = BotController()
GhostGUI(controller).run()
def run_cli():
startup_check.check()
cfg = Config()
token = cfg.get("token")
if not token:
console.error("No token found. Please enter one below.")
token = input("> ")
cfg.set("token", token)
cfg.save()
console.info("Starting bot.")
controller = BotController()
controller.start()
try:
while True:
pass
except KeyboardInterrupt:
console.info("Exiting.")
def main():
get_application_support()
startup_check.check()
cfg = Config()
cfg.check()
if HEADLESS:
console.info("Running in headless (CLI) mode.")
run_cli()
return
console.info("Running in GUI mode.")
if cfg.get_skip_fonts():
cfg.set_skip_fonts(False)
run_gui()
elif check_fonts():
run_gui()
else:
FontCheckGUI().run()
run_gui()
if __name__ == "__main__":
main()