automeme/automeme_database_tools.py

18 lines
534 B
Python

from sqlalchemy.orm import Session
from sqlalchemy import create_engine
from automeme import get_real_filename
from BotModels import Base, User
import sys
if __name__ == "__main__":
db_filename = "automeme_database.db"
engine = create_engine(f"sqlite:///{get_real_filename(db_filename)}")
Base.metadata.create_all(engine)
with Session(engine) as session:
command = sys.argv[1]
if (command == "reset_users"):
User.reset_all_comments(session)
print("Reset the users!")