1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Administrator-py/db/WarnAction.py

21 lines
649 B
Python
Raw Normal View History

2020-08-02 19:41:38 +02:00
from datetime import timedelta
from db import Base
from sqlalchemy import Column, Integer, BigInteger, Float, String
class WarnAction(Base):
__tablename__ = "warn_actions"
id = Column(Integer, primary_key=True)
guild = Column(BigInteger, nullable=False)
count = Column(Float, nullable=False, unique=True)
action = Column(String, nullable=False)
duration = Column(BigInteger)
def __init__(self, guild: int, count: int, action: str, duration: timedelta = None):
self.guild = guild
self.count = count
self.action = action
if duration:
self.duration = duration.total_seconds()