-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
37 lines (25 loc) · 980 Bytes
/
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
import asyncio
import logging
from colorama import init as init_colorama
from bot import CelesteBot
def setup_logging():
FORMAT = '%(asctime)s - [%(levelname)s]: %(message)s'
DATE_FORMAT = '%d/%m/%Y (%H:%M:%S)'
logger = logging.getLogger('discord')
logger.setLevel(logging.INFO)
file_handler = logging.FileHandler(filename='discord.log', mode='a', encoding='utf-8')
file_handler.setFormatter(logging.Formatter(fmt=FORMAT, datefmt=DATE_FORMAT))
file_handler.setLevel(logging.INFO)
logger.addHandler(file_handler)
console_handler = logging.StreamHandler()
console_handler.setFormatter(logging.Formatter(fmt=FORMAT, datefmt=DATE_FORMAT))
console_handler.setLevel(logging.WARNING)
logger.addHandler(console_handler)
async def run_bot():
async with bot:
await bot.run()
if __name__ == "__main__":
init_colorama(autoreset=True)
setup_logging()
bot = CelesteBot()
asyncio.run(run_bot())