forked from hypergonial/snedbot_v1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·85 lines (74 loc) · 2.17 KB
/
main.py
File metadata and controls
executable file
·85 lines (74 loc) · 2.17 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
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/python3
import logging
import traceback
from classes.bot import SnedBot
try:
from config import config
except ImportError:
logging.error(
"Failed loading configuration. Please make sure 'config.py' exists in the root directory of the project and contains valid data."
)
exit()
try:
import uvloop
uvloop.install()
except (ModuleNotFoundError, ImportError):
logging.warning(
'Failed to import uvloop, expect degraded performance!\nFor best performance, please "pip install uvloop"!'
)
"""
All extensions that are loaded on boot-up, change these to alter what modules you want.
Please note that removing essential extensions may cause fatal errors to occur.
"""
initial_extensions = (
# Essential
"extensions.permissions",
"extensions.admin_commands",
"extensions.timers",
"extensions.help",
"extensions.homeguild",
# Non-essential
"extensions.moderation",
"extensions.settings",
"extensions.automod",
"extensions.role_buttons",
"extensions.events",
"extensions.ktp",
"extensions.matchmaking",
"extensions.tags",
"extensions.userlog",
"extensions.reminders",
"extensions.fun",
"extensions.fallingfrontier",
"extensions.aestris",
"extensions.annoverse",
"extensions.giveaway",
"extensions.ipc",
"extensions.misc_commands",
"extensions.context_menus",
"jishaku",
)
TOKEN = config["token"]
bot = SnedBot(config)
if __name__ == "__main__":
"""
Loading extensions from the list of extensions defined in initial_extensions
"""
for extension in initial_extensions:
try:
bot.load_extension(extension)
except Exception as e:
logging.error(f"Failed to load extension {extension}.")
traceback.print_exc()
# Run bot with token from config.py
if __name__ == "__main__":
try:
if hasattr(bot, "ipc"):
logging.info("IPC was disabled.")
# bot.ipc.start()
else:
logging.warn("IPC was not found, or configured correctly!")
bot.run(TOKEN)
except KeyboardInterrupt:
bot.loop.run_until_complete(bot.pool.close())
bot.close()