Files
post-proposal-bot/src/utils/db/models/invite.py
2026-04-16 01:16:54 +02:00

18 lines
391 B
Python

from typing import Literal
from beanie import Document
class Invite(Document):
code: str
channel_id: int
mode: Literal["instant", "approval"]
used: bool = False
class Settings:
name = "invites"
@classmethod
async def get_by_code(cls, code: str) -> "Invite | None":
return await cls.find_one(cls.code == code, cls.used == False) # noqa: E712