-
Notifications
You must be signed in to change notification settings - Fork 63
/
bot.py
39 lines (33 loc) · 1.01 KB
/
bot.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
import os
import traceback
import json
import discord
from discord.ext import commands
DESCRIPTION = """
A self-hosted music discord bot, with detailed
documentation and constantly upgrading features.
"""
with open("config.json", "r") as config_file:
config = json.load(config_file)
prefix = config["PREFIX"]
class Chords(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.members = True
super().__init__(
command_prefix=prefix,
description=DESCRIPTION,
heartbeat_timeout=150.0,
intents=intents,
help_command=None,
)
self._load_extensions()
def _load_extensions(self) -> None:
cogs_dir = os.listdir("cogs")
for filename in cogs_dir:
if filename.endswith(".py"):
cog = filename[:-3]
try:
self.load_extension(f"cogs.{cog}")
except Exception as e:
traceback.print_exc()