Skip to content

Commit

Permalink
allow to send more then one picture?????
Browse files Browse the repository at this point in the history
Signed-off-by: viste <viste02@gmail.com>
  • Loading branch information
Viste committed Sep 20, 2024
1 parent 2a51af4 commit 9ad36c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import html
import logging

Expand Down Expand Up @@ -33,25 +34,26 @@ async def work_send_meme(message: types.Message):
else:
logging.info('info about message %s', message)

# Определяем имя и фамилию пользователя
if message.chat.first_name is None or message.chat.first_name == "" or message.chat.first_name == "\xad":
sender_name = message.chat.username
else:
sender_name = message.chat.first_name

sender_lastname = message.chat.last_name if message.chat.last_name else ' '

text = f"Мем прислал: {sender_name} {sender_lastname}"

if message.media_group_id:

if message.media_group_id not in media_groups:
media_groups[message.media_group_id] = []

media_groups[message.media_group_id].append(types.InputMediaPhoto(media=message.photo[-1].file_id))

logging.info('id of file %s', message.photo[-1].file_id)

if message.media_group_id in media_groups and len(media_groups[message.media_group_id]) == message.media_group_id_length:
await asyncio.sleep(1)

if message.media_group_id in media_groups:
await memes.send_media_group(channel, media=media_groups[message.media_group_id])
await message.reply("Спасибо за мемы! Пока-пока")
del media_groups[message.media_group_id]
Expand Down

0 comments on commit 9ad36c3

Please sign in to comment.