-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
50 lines (36 loc) · 1.15 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
try:
import discord
from discord.ext import commands
import emoji
import requests
except ImportError:
print(
"Please install the dependencies before starting the bot.\nUse 'pip install -r requirements.txt' on Linux."
)
exit()
import os
import asyncio
from datahandler.configHandle import ConfigHandle
async def load_extension(bot):
print("[Startup] Loading Commands...")
for ext in os.listdir("./cogs/"):
if ext.endswith(".py") and not ext.startswith("__"):
await bot.load_extension("cogs." + ext[:-3])
print("[Startup] Commands loaded.")
async def start_bot():
print("[Startup] Prepare to start Bot...")
ch = ConfigHandle()
intents = discord.Intents.all()
intents.presences = True
intents.members = True
bot = commands.Bot(
command_prefix=ch.getFromConfig("command_prefix"), intents=intents
)
ch.config["log"] = "False"
ch.saveConfig()
print("[Startup] Set log to False.")
await load_extension(bot)
print("[Startup] Starting Bot...")
await bot.start(ch.getFromConfig("token"))
if __name__ == "__main__":
asyncio.run(start_bot())