-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (41 loc) · 1.5 KB
/
main.py
File metadata and controls
51 lines (41 loc) · 1.5 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
# coding=utf-8
import asyncio
import discord
import uvloop
from utils.bot_class import dOGbot
from utils.config import load_config
from utils.custom_help import EmbedHelpCommand
from utils.models import init_db_connection
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
config = load_config()
if config['database']['enable']:
asyncio.ensure_future(init_db_connection(config['database']))
# https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents
intents = discord.Intents.none()
intents.guilds = True
intents.messages = True
intents.reactions = True
intents.presences = False # Privileged
intents.members = True # Privileged
intents.bans = False
intents.emojis = False
intents.integrations = False
intents.webhooks = False
intents.invites = False
intents.voice_states = False
intents.typing = False
# https://discordpy.readthedocs.io/en/latest/api.html#discord.AllowedMentions
allowed_mentions = discord.AllowedMentions(
everyone=False,
roles=False,
users=True,
)
bot = dOGbot(description=config["bot"]["description"], intents=intents, allowed_mentions=allowed_mentions,
help_command=EmbedHelpCommand(), )
for cog_name in config["cogs"]["cogs_to_load"]:
try:
bot.load_extension(cog_name)
bot.logger.debug(f"> {cog_name} loaded!")
except Exception as e:
bot.logger.exception('> Failed to load extension {}\n{}: {}'.format(cog_name, type(e).__name__, e))
bot.run(config['auth']['discord']['token'])