-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (30 loc) · 935 Bytes
/
main.py
File metadata and controls
40 lines (30 loc) · 935 Bytes
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
"""TechSupport Bot main thread."""
import logging
import os
import discord
import bot
MODULE_LOG_LEVELS = {
"discord": logging.INFO,
"gino": logging.WARNING,
}
for module_name, level in MODULE_LOG_LEVELS.items():
logging.getLogger(module_name).setLevel(level)
try:
debug_mode = bool(int(os.environ.get("DEBUG", 0)))
except TypeError:
debug_mode = False
logging.basicConfig(
level=logging.DEBUG if debug_mode else logging.INFO,
format="%(asctime)s.%(msecs)03d %(levelname)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
intents = discord.Intents.all()
intents.members = True
bot_ = bot.TechSupportBot(
intents=intents,
allowed_mentions=discord.AllowedMentions(everyone=False, roles=False),
)
# Creates & starts a custom event loop for the bot, because Modmail runs its own one as well and
# you can not run nested asyncio loops
bot.loop.create_task(bot_.start())
bot.loop.run_forever()