-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
59 lines (48 loc) · 2.2 KB
/
main.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import asyncio
from pathlib import Path
from discord_bot.build import BuildBot
from utils.tools import make_filepaths
# __ __
# /\ \ __ /\ \ __
# \_\ \ /\_\ ____ ___ ___ _ __ \_\ \ __ /\_\
# /'_` \ \/\ \ /',__\ /'___\ / __`\ /\`'__\ /'_` \ _______ /'__`\ \/\ \
# /\ \L\ \ \ \ \ /\__, `\/\ \__/ /\ \L\ \\ \ \/ /\ \L\ \ /\______\/\ \L\.\_ \ \ \
# \ \___,_\ \ \_\\/\____/\ \____\\ \____/ \ \_\ \ \___,_\\/______/\ \__/.\_\ \ \_\
# \/__,_ / \/_/ \/___/ \/____/ \/___/ \/_/ \/__,_ / \/__/\/_/ \/_/
#
#
# discord-ai: A Discord bot written in Python with LangChain and ChatGPT integration.
# This bot's primary objective in life is to assist in fulfilling gpt-engineering's mission.
# Thanks and have fun yall! -RareMojo
def launch_bot():
"""
Ensures that the bot's files are set up, then builds and starts the bot.
Launch this file to start the bot. Run: `python main.py` in the command line.
"""
src_dir = Path(__file__).parent.absolute()
configs_dir = Path(src_dir / "configs")
data_dir = Path(src_dir / "data")
assets = Path(src_dir / "assets")
bot_dir = Path(src_dir / "discord_bot")
logs_dir = Path(data_dir / "logs")
cogs_dir = Path(src_dir / "cogs")
paths = {
"root": src_dir,
"configs": configs_dir,
"src": src_dir,
"data": data_dir,
"assets": assets,
"bot": bot_dir,
"logs": logs_dir,
"cogs": cogs_dir,
}
make_filepaths(paths)
builder = BuildBot(paths)
bot = builder.build_bot()
if bot:
asyncio.run(bot.start_bot())
else:
print("Bot failed to build or start.")
input("Press ENTER to EXIT.")
if __name__ == "__main__":
launch_bot()