kofi: decide whether to load in __init__

this unifies some of the logic with how we load classes
pull/20/head
justcool393 2022-11-17 14:00:19 -06:00
parent 5b03c2535a
commit d80fa23409
2 changed files with 16 additions and 18 deletions

View File

@ -3,7 +3,7 @@ from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
# then load our required constants...
from files.helpers.const import FEATURES
from files.helpers.const import FEATURES, KOFI_TOKEN
# then load all of our classes :)
from .alts import *
@ -29,7 +29,8 @@ from .lottery import *
from .casino_game import *
from .hats import *
from .marsey import *
from .transactions import *
if KOFI_TOKEN:
from .transactions import *
from .sub_logs import *
from .media import *
if FEATURES['STREAMERS']:

View File

@ -1,19 +1,16 @@
from files.helpers.const import KOFI_TOKEN
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import *
if KOFI_TOKEN:
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import *
from files.classes import Base
from files.classes import Base
class Transaction(Base):
__tablename__ = "transactions"
id = Column(String, primary_key=True)
created_utc = Column(Integer)
type = Column(String)
amount = Column(Integer)
email = Column(String)
claimed = Column(Boolean)
class Transaction(Base):
__tablename__ = "transactions"
id = Column(String, primary_key=True)
created_utc = Column(Integer)
type = Column(String)
amount = Column(Integer)
email = Column(String)
claimed = Column(Boolean)
def __repr__(self):
return f"<Transaction(id={self.id})>"
def __repr__(self):
return f"<Transaction(id={self.id})>"