diff --git a/bots/modules/ping.py b/bots/modules/ping.py index efc95fd..9ecf0db 100644 --- a/bots/modules/ping.py +++ b/bots/modules/ping.py @@ -17,15 +17,15 @@ from bots.models import TelegramBotModuleConfig class PingBotCategory(models.Model): chat_id = models.BigIntegerField(db_index=True) cat_name = models.CharField(max_length=64, db_index=True) - user_ids = JSONField(default='[]') + user_ids = JSONField(null=True) def add_user(self, uid: int): - user_ids = set(self.user_ids) + user_ids = set(self.user_ids or []) user_ids.add(uid) self.user_ids = list(user_ids) def remove_user(self, uid: int): - user_ids = set(self.user_ids) + user_ids = set(self.user_ids or []) user_ids.add(uid) self.user_ids = list(user_ids)