models.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from tortoise.models import Model
  2. from tortoise.fields import (
  3. IntField,
  4. BigIntField,
  5. CharField,
  6. TextField,
  7. BooleanField,
  8. DateField,
  9. ForeignKeyField,
  10. FloatField,
  11. )
  12. class Action(Model):
  13. id = IntField(pk=True)
  14. name = CharField(max_length=64, unique=True)
  15. template = TextField()
  16. kind = IntField()
  17. class Gif(Model):
  18. id = IntField(pk=True)
  19. action = ForeignKeyField("models.Action", related_name="gifs")
  20. file_id = CharField(max_length=64, unique=True)
  21. class StickerPack(Model):
  22. id = IntField(pk=True)
  23. short_name = CharField(max_length=256, unique=True)
  24. sid = BigIntField()
  25. hash = BigIntField()
  26. stickers_count = IntField(default=0)
  27. class Admin(Model):
  28. id = IntField(pk=True)
  29. user_id = BigIntField(unique=True)
  30. class BirthDay(Model):
  31. id = IntField(pk=True)
  32. peer_id = BigIntField()
  33. user_id = BigIntField()
  34. date = DateField()
  35. class VPNServer(Model):
  36. id = IntField(pk=True)
  37. name = CharField(max_length=64, unique=True)
  38. ip = CharField(max_length=15, unique=True)
  39. class AllowedChat(Model):
  40. id = IntField(pk=True)
  41. peer_id = BigIntField(unique=True)
  42. class MarkovChat(Model):
  43. id = IntField(pk=True)
  44. peer_id = BigIntField(unique=True)
  45. opt_reply_prob = FloatField(default=1.0)
  46. opt_message_prob = FloatField(default=0.8)