forked from Yuhanun/TCSDiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
39 lines (32 loc) · 899 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
38
39
import aiohttp
import aiosqlite
import asyncio
import discord
from discord.ext import commands
from backend.config import DATABASE_LOCATION
if __name__ == "__main__":
with open("token.txt") as file:
TOKEN = file.read().strip()
bot = commands.Bot(".", case_insensitive=True)
@bot.event
async def on_ready():
bot._session = aiohttp.ClientSession()
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
print(discord.utils.oauth_url(bot.user.id))
async def connect_db():
bot._db = await aiosqlite.connect(DATABASE_LOCATION)
if __name__ == "__main__":
bot.loop.run_until_complete(connect_db())
extensions = [
"cogs.rolehelper",
"cogs.moderation",
"cogs.fun",
"cogs.rtfm",
"cogs.dasmooi",
"cogs.laf"
]
[bot.load_extension(ext) for ext in extensions]
bot.run(TOKEN)