fix
This commit is contained in:
parent
db530d98fd
commit
789a3c0a9d
@ -17,15 +17,15 @@ from bots.models import TelegramBotModuleConfig
|
|||||||
class PingBotCategory(models.Model):
|
class PingBotCategory(models.Model):
|
||||||
chat_id = models.BigIntegerField(db_index=True)
|
chat_id = models.BigIntegerField(db_index=True)
|
||||||
cat_name = models.CharField(max_length=64, 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):
|
def add_user(self, uid: int):
|
||||||
user_ids = set(self.user_ids)
|
user_ids = set(self.user_ids or [])
|
||||||
user_ids.add(uid)
|
user_ids.add(uid)
|
||||||
self.user_ids = list(user_ids)
|
self.user_ids = list(user_ids)
|
||||||
|
|
||||||
def remove_user(self, uid: int):
|
def remove_user(self, uid: int):
|
||||||
user_ids = set(self.user_ids)
|
user_ids = set(self.user_ids or [])
|
||||||
user_ids.add(uid)
|
user_ids.add(uid)
|
||||||
self.user_ids = list(user_ids)
|
self.user_ids = list(user_ids)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user