-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (40 loc) · 1.16 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
51
52
53
54
import discord
from discord.ext import commands
import os # default module
from dotenv import load_dotenv
import logging
import colorlog
load_dotenv() # load all the variables from the env file
### --- Setup logger with colorlog --- ###
handler = colorlog.StreamHandler()
# Create a formatter
formatter = colorlog.ColoredFormatter(
"%(log_color)s[%(levelname)s] [%(name)s] %(message)s%(reset)s",
log_colors={
"DEBUG": "cyan",
"INFO": "green",
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "bold_red",
},
secondary_log_colors={},
style="%",
)
handler.setFormatter(formatter)
logging.basicConfig(
format="[%(levelname)s] [%(name)s] [%(message)s]",
level=logging.INFO,
handlers=[handler],
)
### ----------------------------------- ###
bot = discord.Bot()
cogs_list = ["music"]
for cog in cogs_list:
bot.load_extension(f"cogs.{cog}")
@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")
await bot.change_presence(
activity=discord.Game(name=f"in {len(bot.guilds)} servers. /play")
)
bot.run(os.getenv("DISCORD_TOKEN")) # run the bot with the token