Skip to content

Commit

Permalink
update
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 11058a0 commit e7cfd1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@
media_group_timers = {}


async def send_media_group(group_id, caption):
async def send_media_group(group_id, caption, message: types.Message):
if group_id in media_groups:
media_groups[group_id][0].caption = caption
await memes.send_media_group(channel, media=media_groups[group_id])
del media_groups[group_id]
del media_group_timers[group_id]

await message.reply("Спасибо за котю! Приходи еще")

async def group_send_delay(group_id, caption):

async def group_send_delay(group_id, caption, message: types.Message):
await asyncio.sleep(5)
await send_media_group(group_id, caption)
await send_media_group(group_id, caption, message)

@router.message(Command(commands="start", ignore_case=True), F.chat.type == "private")
async def start_handler(message: types.Message):
Expand Down Expand Up @@ -66,7 +68,7 @@ async def work_send_meme(message: types.Message):
logging.info('id of file %s', message.photo[-1].file_id)

if group_id not in media_group_timers:
media_group_timers[group_id] = asyncio.create_task(group_send_delay(group_id, caption))
media_group_timers[group_id] = asyncio.create_task(group_send_delay(group_id, caption, message))

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

0 comments on commit e7cfd1a

Please sign in to comment.