release 2.0

This commit is contained in:
2025-12-23 03:09:27 +03:00
parent 16c2622d13
commit f99fd8118c
9 changed files with 115 additions and 47 deletions
+18 -12
View File
@@ -87,18 +87,24 @@ def handle_vk_birthdate():
vk = vk_session.get_api()
for user in birthdayUsers:
new_post = vk.wall.post(
owner_id=-vkApi.group_id,
from_group=1,
message=user.congratulations.strip(),
attachments=user.photo_link,
)
if not user.congratulations or not user.photo_link:
logger.error(f"Пользователь {user.short_name} не настроен для публикации")
continue
try:
new_post = vk.wall.post(
owner_id=-vkApi.group_id,
from_group=1,
message=user.congratulations.strip(),
attachments=user.photo_link,
)
logger.info(f"Пост #{new_post.get('post_id')} создан")
logger.info(f"Пост #{new_post.get('post_id')} создан")
user.post_link = (
f"https://vk.com/wall-{vkApi.group_id}_{new_post.get('post_id')}"
)
user.publish_at = datetime.now()
user.post_link = (
f"https://vk.com/wall-{vkApi.group_id}_{new_post.get('post_id')}"
)
user.publish_at = datetime.now()
db.session.commit()
db.session.commit()
except Exception as e:
logger.error(f"Ошибка при публикации поста: {e}")