TelegramPlayGround / pyrogram

PyroGramFORK | Telegram MTProto API framework in Python for users and bots | PyroGramFORK
https://telegramplayground.github.io/pyrogram/
GNU Lesser General Public License v3.0
79 stars 13 forks source link

copy_message set protected_content False not take effect #70

Closed fivepe closed 2 months ago

fivepe commented 2 months ago

Checklist

Description

The robot obtains a protected video, copies it, and sets protect_content to False, but new messages still show that it is in the protected state.

Steps to reproduce

app.start() msg = app.get_messages("@stargfpic", 21077) print(msg) new_msg = app.copy_message(xxxx, "@stargfpic", 21077, protect_content=False) print(new_msg)

Code example

print(msg)
{
    "_": "Message",
    "id": 21077,
    "sender_chat": {
        "_": "Chat",
        "id": -1001764029887,
        "type": "ChatType.CHANNEL",
        "is_verified": false,
        "is_restricted": true,
        "is_creator": false,
        "is_scam": false,
        "is_fake": false,
        "title": "明星网红AI换脸",
        "username": "stargfpic",
        "photo": {
            "_": "ChatPhoto",
            "small_file_id": "AQADBQADVsAxG8XOuFUAEAIAA0H6NcIW____SaP6CPLiW_sABB4E",
            "small_photo_unique_id": "AgADVsAxG8XOuFU",
            "big_file_id": "AQADBQADVsAxG8XOuFUAEAMAA0H6NcIW____SaP6CPLiW_sABB4E",
            "big_photo_unique_id": "AgADVsAxG8XOuFU",
            "has_animation": false,
            "is_personal": false
        },
        "dc_id": 5,
        "has_protected_content": false,
        "restrictions": [
            {
                "_": "Restriction",
                "platform": "ios",
                "reason": "porn",
                "text": "This channel can’t be displayed because it was used to spread pornographic content."
            }
        ],
        "is_forum": false
    },
    "date": "2024-08-03 07:57:13",
    "chat": {
        "_": "Chat",
        "id": -1001764029887,
        "type": "ChatType.CHANNEL",
        "is_verified": false,
        "is_restricted": true,
        "is_creator": false,
        "is_scam": false,
        "is_fake": false,
        "title": "明星网红AI换脸",
        "username": "stargfpic",
        "photo": {
            "_": "ChatPhoto",
            "small_file_id": "AQADBQADVsAxG8XOuFUAEAIAA0H6NcIW____SaP6CPLiW_sABB4E",
            "small_photo_unique_id": "AgADVsAxG8XOuFU",
            "big_file_id": "AQADBQADVsAxG8XOuFUAEAMAA0H6NcIW____SaP6CPLiW_sABB4E",
            "big_photo_unique_id": "AgADVsAxG8XOuFU",
            "has_animation": false,
            "is_personal": false
        },
        "dc_id": 5,
        "has_protected_content": false,
        "restrictions": [
            {
                "_": "Restriction",
                "platform": "ios",
                "reason": "porn",
                "text": "This channel can’t be displayed because it was used to spread pornographic content."
            }
        ],
        "is_forum": false
    },
    "mentioned": false,
    "scheduled": false,
    "from_scheduled": false,
    "media": "MessageMediaType.VIDEO",
    "edit_date": "2024-08-03 08:08:34",
    "has_protected_content": true,
    "is_from_offline": false,
    "has_media_spoiler": false,
    "caption_entities": [
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.HASHTAG",
            "offset": 0,
            "length": 9
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.TEXT_LINK",
            "offset": 27,
            "length": 6,
            "url": "https://t.me/stargfpic/21065"
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.CUSTOM_EMOJI",
            "offset": 34,
            "length": 2,
            "custom_emoji_id": 5947236241199074198
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.CUSTOM_EMOJI",
            "offset": 49,
            "length": 2,
            "custom_emoji_id": 5947236241199074198
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.HASHTAG",
            "offset": 71,
            "length": 4
        }
    ],
    "show_caption_above_media": false,
    "video": {
        "_": "Video",
        "file_id": "BAACAgUAAx0CaST1vwACUlVmrZARXOkBRTmoNHcOlgSSLMoqYgACHxAAAme6YFesfmkYBJ94ix4E",
        "file_unique_id": "AgADHxAAAme6YFc",
        "width": 1920,
        "height": 1080,
        "duration": 1692.0,
        "file_name": "not_wonyoung.mp4",
        "mime_type": "video/mp4",
        "file_size": 1106682799,
        "supports_streaming": true,
        "date": "2024-06-14 18:03:55",
        "thumbs": [
            {
                "_": "Thumbnail",
                "file_id": "AAMCBQADHQJpJPW_AAJSVWatkBFc6QFFOag0dw6WBJIsyipiAAIfEAACZ7pgV6x-aRgEn3iLAAgBAAdtAAceBA",
                "file_unique_id": "AgADHxAAAme6YFc",
                "width": 320,
                "height": 180,
                "file_size": 10781
            }
        ]
    },
    "caption": "#Wonyoung 张元英 反差少妇OL女同事\n\n* 第一轮第五场\n🏆 Wonyoung 胜出 🏆\n\n作者Captain_Y共1834部,#日韩群 全收集",
    "views": 2015,
    "forwards": 0,
    "outgoing": false,
    "reply_markup": {
        "_": "InlineKeyboardMarkup",
        "inline_keyboard": [
            [
                {
                    "_": "InlineKeyboardButton",
                    "text": "中韩骚逼大作战🆚",
                    "url": "https://t.me/stargfpic/21034"
                }
            ],
            [
                {
                    "_": "InlineKeyboardButton",
                    "text": "🇯🇵日韩目录🇰🇷",
                    "url": "https://t.me/stargfpic/16"
                }
            ]
        ]
    }
}

Logs

print(new_msg)

{
    "_": "Message",
    "id": 502,
    "from_user": {
        "_": "User",
        "id": xxxxxxxx,
        "is_self": true,
        "is_contact": false,
        "is_mutual_contact": false,
        "is_deleted": false,
        "is_bot": true,
        "is_verified": false,
        "is_restricted": false,
        "is_scam": false,
        "is_fake": false,
        "is_support": false,
        "is_premium": false,
        "first_name": "xxxxx",
        "username": "xxxxxxxx",
        "added_to_attachment_menu": false,
        "can_be_added_to_attachment_menu": false,
        "can_join_groups": true,
        "can_read_all_group_messages": false,
        "supports_inline_queries": false,
        "restricts_new_chats": false,
        "inline_need_location": false,
        "can_be_edited": true,
        "can_connect_to_business": false,
        "is_close_friend": false,
        "have_access": true,
        "has_main_web_app": false
    },
    "date": "2024-08-03 10:04:01",
    "chat": {
        "_": "Chat",
        "id": xxxxxx,
        "type": "ChatType.PRIVATE",
        "is_verified": false,
        "is_restricted": false,
        "is_scam": false,
        "is_fake": false,
        "is_support": false,
        "username": "xxxxxx",
        "first_name": "xxxxxx",
        "photo": {
            "_": "ChatPhoto",
            "small_file_id": "AQADAQADTKoxGz7ZuEYAEAIAAynqvUoBAAMo_szudA64OgAEHgQ",
            "small_photo_unique_id": "AgADTKoxGz7ZuEY",
            "big_file_id": "AQADAQADTKoxGz7ZuEYAEAMAAynqvUoBAAMo_szudA64OgAEHgQ",
            "big_photo_unique_id": "AgADTKoxGz7ZuEY",
            "has_animation": false,
            "is_personal": false
        },
        "dc_id": 1
    },
    "mentioned": false,
    "scheduled": false,
    "from_scheduled": false,
    "media": "MessageMediaType.VIDEO",
    "has_protected_content": true,
    "is_from_offline": false,
    "has_media_spoiler": false,
    "caption_entities": [
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.HASHTAG",
            "offset": 0,
            "length": 9
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.TEXT_LINK",
            "offset": 27,
            "length": 6,
            "url": "https://t.me/stargfpic/21065"
        },
        {
            "_": "MessageEntity",
            "type": "MessageEntityType.HASHTAG",
            "offset": 71,
            "length": 4
        }
    ],
    "show_caption_above_media": false,
    "video": {
        "_": "Video",
        "file_id": "BAACAgUAAxkDAAIB9matkBEO3Ab2MnHIHyFzJvWzBgJxAAIfEAACZ7pgV6x-aRgEn3iLHgQ",
        "file_unique_id": "AgADHxAAAme6YFc",
        "width": 1920,
        "height": 1080,
        "duration": 1692.0,
        "file_name": "not_wonyoung.mp4",
        "mime_type": "video/mp4",
        "file_size": 1106682799,
        "supports_streaming": true,
        "date": "2024-06-14 18:03:55",
        "thumbs": [
            {
                "_": "Thumbnail",
                "file_id": "AAMCBQADGQMAAgH2Zq2QEQ7cBvYyccgfIXMm9bMGAnEAAh8QAAJnumBXrH5pGASfeIsACAEAB20ABx4E",
                "file_unique_id": "AgADHxAAAme6YFc",
                "width": 320,
                "height": 180,
                "file_size": 10781
            }
        ]
    },
    "caption": "#Wonyoung 张元英 反差少妇OL女同事\n\n* 第一轮第五场\n🏆 Wonyoung 胜出 🏆\n\n作者Captain_Y共1834部,#日韩群 全收集",
    "outgoing": true
}

has_protected_content is still True