mirror of
https://github.com/Xevion/contest-assistant.git
synced 2025-12-06 01:14:37 -06:00
add sqlalchemy to bot startup, fix PyCharm typehinting for Session context manager, simplify autocommit and autoclose separate context managers into singular with kwargs
This commit is contained in:
7
main.py
7
main.py
@@ -1,7 +1,10 @@
|
||||
import logging
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
from bot import constants
|
||||
from bot.bot import ContestBot
|
||||
from bot.models import Base
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger = logging.getLogger(__file__)
|
||||
@@ -16,7 +19,9 @@ if __name__ == "__main__":
|
||||
|
||||
initial_extensions = ['contest.cogs.contest']
|
||||
|
||||
bot = ContestBot(description='A assistant for the Photography Lounge\'s monday contests')
|
||||
engine = create_engine(constants.DATABASE)
|
||||
Base.metadata.create_all(engine)
|
||||
bot = ContestBot(engine, description='A assistant for the Photography Lounge\'s monday contests')
|
||||
|
||||
for extension in initial_extensions:
|
||||
bot.load_extension(extension)
|
||||
|
||||
Reference in New Issue
Block a user