мелкие правки
This commit is contained in:
+3
-4
@@ -112,14 +112,11 @@ def getFreeSlots(vkPost) -> dict:
|
|||||||
|
|
||||||
url = medodsApi.url + requestParams.url_path
|
url = medodsApi.url + requestParams.url_path
|
||||||
|
|
||||||
logger.info(url)
|
|
||||||
logger.info(json)
|
|
||||||
response = send_request(
|
response = send_request(
|
||||||
requestParams.method,
|
requestParams.method,
|
||||||
url,
|
url,
|
||||||
json,
|
json,
|
||||||
)
|
)
|
||||||
logger.info(response)
|
|
||||||
if not response:
|
if not response:
|
||||||
logger.error("Ответ не получен")
|
logger.error("Ответ не получен")
|
||||||
return {}
|
return {}
|
||||||
@@ -170,8 +167,10 @@ def setDynamicText():
|
|||||||
dynamicText = f"📌 Свободная запись на 📅 {dateText}:\n\n"
|
dynamicText = f"📌 Свободная запись на 📅 {dateText}:\n\n"
|
||||||
|
|
||||||
for user in users:
|
for user in users:
|
||||||
sex_icon = "👨⚕️" if user["sex"] == "male" else "👩⚕️"
|
|
||||||
slots = freeSlots["slots"][str(user["id"])]
|
slots = freeSlots["slots"][str(user["id"])]
|
||||||
|
if len(slots) == 0:
|
||||||
|
continue
|
||||||
|
sex_icon = "👨⚕️" if user["sex"] == "male" else "👩⚕️"
|
||||||
name = user["name"] if vkPost.full_name else user["shortName"]
|
name = user["name"] if vkPost.full_name else user["shortName"]
|
||||||
|
|
||||||
dynamicText += f"{sex_icon} {name} ({', '.join(user['specialties'])}):\n"
|
dynamicText += f"{sex_icon} {name} ({', '.join(user['specialties'])}):\n"
|
||||||
|
|||||||
+2
-2
@@ -29,16 +29,16 @@ def handle_vk_post():
|
|||||||
new_post = {}
|
new_post = {}
|
||||||
|
|
||||||
if vkPost.dynamic_text:
|
if vkPost.dynamic_text:
|
||||||
logger.info("Публикация поста")
|
|
||||||
new_post = vk.wall.post(
|
new_post = vk.wall.post(
|
||||||
owner_id=-vkApi.group_id,
|
owner_id=-vkApi.group_id,
|
||||||
from_group=1,
|
from_group=1,
|
||||||
message=f"{vkPost.dynamic_text}\n{vkPost.static_text}".strip(),
|
message=f"{vkPost.dynamic_text}\n{vkPost.static_text}".strip(),
|
||||||
attachments=f"photo-{vkApi.group_id}_{vkApi.base_photo_url}",
|
attachments=f"photo-{vkApi.group_id}_{vkApi.base_photo_url}",
|
||||||
)
|
)
|
||||||
|
logger.info(f"Пост #{new_post.get('post_id')} создан")
|
||||||
|
|
||||||
if vkPost.post_id:
|
if vkPost.post_id:
|
||||||
logger.info("Удаление поста")
|
logger.info(f"Удаление поста #{vkPost.post_id}")
|
||||||
vk.wall.delete(owner_id=-vkApi.group_id, post_id=vkPost.post_id)
|
vk.wall.delete(owner_id=-vkApi.group_id, post_id=vkPost.post_id)
|
||||||
vkPost.post_id = None
|
vkPost.post_id = None
|
||||||
vkPost.publish_at = None
|
vkPost.publish_at = None
|
||||||
|
|||||||
Reference in New Issue
Block a user