-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
43 lines (34 loc) · 1.23 KB
/
Copy pathapp.py
File metadata and controls
43 lines (34 loc) · 1.23 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
"""
Entry point of the bot and the API.
https://github.com/redstone-squid/Redstone-Squid
"""
import multiprocessing
import sys
from dotenv import load_dotenv
from squid.api import main as api_main
from squid.bot import ApplicationConfig
from squid.bot import main as bot_main
if __name__ == "__main__":
# Check .env.example for environment variables configuration
config: ApplicationConfig = {
"dev_mode": False,
"dotenv_path": ".env",
"bot_config": {
"prefix": "!",
"owner_id": 353089661175988224,
"owner_server_id": 433618741528625152,
"bot_name": "Redstone Squid",
"bot_version": "1.5.7",
"source_code_url": "https://github.com/redstone-squid/Redstone-Squid",
"print_tracebacks": True,
},
}
if config.get("dotenv_path"):
load_dotenv(config.get("dotenv_path"))
multiprocessing.Process(target=api_main).start()
if sys.platform == "win32":
import asyncio
asyncio.run(bot_main(config=config), debug=config.get("dev_mode", False))
else:
import uvloop # pyright: ignore[reportMissingImports]
uvloop.run(bot_main(config=config), debug=config.get("dev_mode", False))