Пример #1
0
def reply_msg(message: Message, message2: Message, delete_orig=False):
    try:
        message2.copy(chat_id=message.chat.id, reply_to_message_id=message.id)

        if delete_orig:
            message.delete()
    except Exception as e:
        raise e
Пример #2
0
async def pipes_worker_userbot(_, message: Message):
    for pipe in pipes_list_userbot:
        if pipe["from_chat_id"] == message.chat.id:
            if not message.text:
                m, temp = await asyncio.gather(app.listen(USERBOT_ID),
                                               message.copy(BOT_ID))
                caption = f"Forwarded from `{pipe['from_chat_id']}`"
                caption = f"{temp.caption}\n\n{caption}" if temp.caption else caption
                await app.copy_message(pipe["to_chat_id"],
                                       USERBOT_ID,
                                       m.message_id,
                                       caption=caption)
                await asyncio.sleep(10)
                await temp.delete()
                return
            caption = f"Forwarded from `{pipe['from_chat_id']}`"
            await app.send_message(pipe["to_chat_id"],
                                   text=message.text + "\n\n" + caption)
Пример #3
0
async def pipes_worker_userbot(_, message: Message):
    chat_id = message.chat.id

    if chat_id in pipes_list_bot:
        caption = f"\n\nForwarded from `{chat_id}`"
        to_chat_id = pipes_list_bot[chat_id]

        if not message.text:
            m, temp = await asyncio.gather(app.listen(USERBOT_ID),
                                           message.copy(BOT_ID))
            caption = (f"{temp.caption}{caption}" if temp.caption else caption)

            await app.copy_message(
                to_chat_id,
                USERBOT_ID,
                m.message_id,
                caption=caption,
            )
            await asyncio.sleep(2)
            return await temp.delete()

        await app.send_message(to_chat_id, text=message.text + caption)