uploader-bot/app/core/models/messages.py

23 lines
842 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from base58 import b58decode
from sqlalchemy import Column, Integer, String, DateTime, JSON, BigInteger, Boolean
from .base import AlchemyBase
# Only for clean old messages now
class KnownTelegramMessage(AlchemyBase):
__tablename__ = 'known_telegram_messages'
id = Column(Integer, autoincrement=True, primary_key=True)
type = Column(String(64), nullable=True)
bot_id = Column(Integer, nullable=False, default=1) # 0 uploader, 1 client
chat_id = Column(BigInteger, nullable=False)
message_id = Column(BigInteger, nullable=False)
from_user = Column(Boolean, nullable=False)
from_telegram_id = Column(BigInteger, nullable=True)
created = Column(DateTime, nullable=False, default=0)
deleted = Column(Boolean, nullable=True, default=False)
meta = Column(JSON, nullable=False, default={})