/
main.py
38 lines (25 loc) · 902 Bytes
/
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
#!/usr/bin/env python
"""
The main entrypoint into the running of the bot.
It loads the settings values from the .env file/the environment variables,
then ensures the Django database is correctly migrated to the latest version and finally begins
the asynchronous running process for the Discord bot.
"""
from collections.abc import Sequence
__all__: Sequence[str] = ("bot",)
import discord
import config
from config import settings
from utils import SuppressTraceback, TeXBot
with SuppressTraceback():
config.run_setup()
intents: discord.Intents = discord.Intents.default()
# noinspection PyDunderSlots,PyUnresolvedReferences
intents.members = True
bot = TeXBot(intents=intents)
bot.load_extension("cogs")
if __name__ == "__main__":
bot.run(settings["DISCORD_BOT_TOKEN"])
if bot.EXIT_WAS_DUE_TO_KILL_COMMAND:
raise SystemExit(0)
raise SystemExit(1)