-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (34 loc) · 1.12 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
import discord
import os
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from classes.discordclient import DiscordClient
from classes.images import Images
class Client(DiscordClient):
def __init__(self) -> None:
self.__images = Images()
self.__database_engine = create_engine(
"sqlite:///roleplay.db", echo=True, future=True)
self.__synced = False
super().__init__(
command_prefix='$',
intents=discord.Intents.all(),)
async def on_ready(self) -> None:
if not self.__synced:
await self.tree.sync()
self.__synced = True
async def setup_hook(self) -> None:
for f in os.listdir("./cogs"):
if f.endswith(".py"):
await self.load_extension("cogs." + f[:-3])
@property
def images(self) -> Images:
return self.__images
@property
def database(self) -> Engine:
'''SQLAlchemy database engine'''
return self.__database_engine
if __name__ == '__main__':
bot = Client()
token = open('token')
bot.run(token.read(70))