-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
49 lines (34 loc) · 1.08 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
40
41
42
43
44
45
46
47
48
49
import os
from typing import Optional
import nextcord
from nextcord.ext import commands
from core import files, log
from core.service import services
config = files.Config()
config_discord = config.discord()
intents = nextcord.Intents.default()
intents.members = True
bot = commands.Bot(activity=config_discord.get_activity(), intents=intents)
service_holder: Optional[services.Holder] = None
def load_extensions():
for fn in os.listdir("./cogs"):
if fn.endswith(".py"):
log.info(f"Loading extension: {fn}")
bot.load_extension(f"cogs.{fn[:-3]}", extras={
"config": config,
"services": service_holder
})
def start():
global service_holder
log.load_logging_handlers()
log.info("Loading services...")
service_holder = services.Holder(bot, config)
log.info("Loading extensions...")
load_extensions()
log.info("Starting bot...")
bot.run(config_discord.token())
@bot.event
async def on_ready():
await service_holder.enable_all()
print("Bot is ready! - @Pterodactyl")
start()