|
|
@@ -4,9 +4,7 @@ import random |
|
|
|
from datetime import datetime |
|
|
|
from typing import cast |
|
|
|
|
|
|
|
from eloquent import DatabaseManager, Model # type: ignore |
|
|
|
|
|
|
|
from config import CONFIG |
|
|
|
from config import DB |
|
|
|
from consts import Character |
|
|
|
from models import Answer, Query, User |
|
|
|
from talk import Talk |
|
|
@@ -14,8 +12,7 @@ from talk import Talk |
|
|
|
|
|
|
|
def main ( |
|
|
|
) -> None: |
|
|
|
db = DatabaseManager (CONFIG) |
|
|
|
Model.set_connection_resolver (db) |
|
|
|
DB.begin_transaction () |
|
|
|
queries: list[Query] = Query.where ('answered', False).get () |
|
|
|
if not queries: |
|
|
|
return |
|
|
@@ -53,6 +50,7 @@ def main ( |
|
|
|
answer.save () |
|
|
|
query.answered = True |
|
|
|
query.save () |
|
|
|
DB.commit () |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|