-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
43 lines (28 loc) · 919 Bytes
/
run.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
# -*- coding: utf-8 -*-
import asyncio
import logging
import sys
import toml
from bot import DropBot
try:
import uvloop
except ImportError:
pass
else:
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
logging.getLogger('discord').setLevel(logging.INFO)
logging.getLogger('dropbot').setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')
handler = logging.FileHandler(filename='dropbot.log', encoding='utf-8', mode='a')
handler.setFormatter(formatter)
stream = logging.StreamHandler(stream=sys.stdout)
stream.setFormatter(formatter)
logging.getLogger().addHandler(handler)
logging.getLogger().addHandler(stream)
with open('config.toml', 'r', encoding='utf-8') as fp:
config = toml.load(fp)
token = config.pop("token")
bot = DropBot('.', config=config)
bot.load_extension("jishaku")
bot.load_extension("cogs.coindrop")
bot.run(token)