Skip to content

Commit 71901b7

Browse files
committed
Рефакторинг кода проекта
1 parent 0ed8d89 commit 71901b7

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/core/database/database.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class GroupsSendMessages(Model):
7777

7878
# Статистика участников
7979
participants_count = IntegerField(null=True) # Количество участников
80-
participants_hidden = TextField(null=True) # Участники скрыты
80+
participants_hidden = TextField(null=True, default='') # Участники скрыты
8181

8282
# Тип группы
8383
type_display = TextField(null=True) # Является ли мегагруппой
@@ -193,17 +193,20 @@ def update_group_send_messages_table(link, telegram_id, title, username, about,
193193

194194

195195
def write_group_send_message_table(chat_input):
196-
chat_input = chat_input.strip()
197-
logger.info(f"Записываем данные: {chat_input}")
196+
try:
197+
chat_input = chat_input.strip()
198+
logger.info(f"Записываем данные: {chat_input}")
198199

199-
# Разделяем по строкам и фильтруем пустые значения
200-
links = [link.strip() for link in chat_input.splitlines() if link.strip()]
200+
# Разделяем по строкам и фильтруем пустые значения
201+
links = [link.strip() for link in chat_input.splitlines() if link.strip()]
201202

202-
logger.info(f"Найдено ссылок: {len(links)}")
203-
for link in links:
204-
logger.debug(f"Сохраняем ссылку: {link}")
205-
group = GroupsSendMessages(link=link)
206-
group.save()
203+
logger.info(f"Найдено ссылок: {len(links)}")
204+
for link in links:
205+
logger.debug(f"Сохраняем ссылку: {link}")
206+
group = GroupsSendMessages(link=link)
207+
group.save()
208+
except Exception as e:
209+
logger.exception(e)
207210

208211

209212
def get_links_table_group_send_messages():

0 commit comments

Comments
 (0)