Telegram 机器人JSON消息例子

  • fennng 

有人加群

{
    "update_id": 23503327,
    "message": {
        "message_id": 585,
        "from": {
            "id": 539065210,
            "is_bot": false,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "language_code": "en-US"
        },
        "chat": {
            "id": -243723653,
            "title": "机器人测试",
            "type": "group",
            "all_members_are_administrators": true
        },
        "date": 1536765953,
        "new_chat_participant": {
            "id": 646807833,
            "is_bot": true,
            "first_name": "YoutubeChannels",
            "username": "YoutubeChannelsBot"
        },
        "new_chat_member": {
            "id": 646807833,
            "is_bot": true,
            "first_name": "YoutubeChannels",
            "username": "YoutubeChannelsBot"
        },
        "new_chat_members": [
            {
                "id": 646807833,
                "is_bot": true,
                "first_name": "YoutubeChannels",
                "username": "YoutubeChannelsBot"
            }
        ]
    }
}

有人退群

  
{
    "update_id": 23503328,
    "message": {
        "message_id": 587,
        "from": {
            "id": 539065210,
            "is_bot": false,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "language_code": "en-US"
        },
        "chat": {
            "id": -243723653,
            "title": "机器人测试",
            "type": "group",
            "all_members_are_administrators": true
        },
        "date": 1536765977,
        "left_chat_participant": {
            "id": 492930333,
            "is_bot": false,
            "first_name": "Bo Jun"
        },
        "left_chat_member": {
            "id": 492930333,
            "is_bot": false,
            "first_name": "Bo Jun"
        }
    }
}

有消息被置顶

  
{
    "update_id": 23503804,
    "message": {
        "message_id": 1242,
        "from": {
            "id": 539065210,
            "is_bot": false,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "language_code": "en-nz"
        },
        "chat": {
            "id": -1001220016062,
            "title": "峰享电报群",
            "username": "fengsharegroup",
            "type": "supergroup"
        },
        "date": 1536889877,
        "pinned_message": {
            "message_id": 1088,
            "from": {
                "id": 539065210,
                "is_bot": false,
                "first_name": "Yufeng Deng",
                "last_name": "峰哥",
                "username": "fennng",
                "language_code": "en-nz"
            },
            "chat": {
                "id": -1001220016062,
                "title": "峰享电报群",
                "username": "fengsharegroup",
                "type": "supergroup"
            },
            "date": 1536456673,
            "forward_from_chat": {
                "id": -1001189603696,
                "title": "峰享频道",
                "username": "fengshare",
                "type": "channel"
            },
            "forward_from_message_id": 21,
            "forward_date": 1536456665,
            "text": "https://youtu.be/Q8IlXt29A4k",
            "entities": [
                {
                    "offset": 0,
                    "length": 28,
                    "type": "url"
                }
            ]
        }
    }
}

有人发图片

  
{
    "update_id": 23503431,
    "message": {
        "message_id": 700,
        "from": {
            "id": 539065210,
            "is_bot": false,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "language_code": "en-US"
        },
        "chat": {
            "id": 539065210,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "type": "private"
        },
        "date": 1536828355,
        "photo": [
            {
                "file_id": "AgADAQAD6acxG-uM2ERbhuvOVZq5lcN1DDAABNaIzKcBfFWUS2oCAAEC",
                "file_size": 606,
                "width": 90,
                "height": 71
            },
            {
                "file_id": "AgADAQAD6acxG-uM2ERbhuvOVZq5lcN1DDAABNEnj3XxiEDzSmoCAAEC",
                "file_size": 4147,
                "width": 320,
                "height": 252
            },
            {
                "file_id": "AgADAQAD6acxG-uM2ERbhuvOVZq5lcN1DDAABA5UjKohgkCWSWoCAAEC",
                "file_size": 5980,
                "width": 421,
                "height": 332
            }
        ],
        "caption": "draw image 121211221",
        "caption_entities": [
            {
                "offset": 11,
                "length": 9,
                "type": "phone_number"
            }
        ]
    }
}

有人发命令

  
{
    "update_id": 23503354,
    "message": {
        "message_id": 592,
        "from": {
            "id": 539065210,
            "is_bot": false,
            "first_name": "Yufeng Deng",
            "last_name": "峰哥",
            "username": "fennng",
            "language_code": "en-US"
        },
        "chat": {
            "id": -243723653,
            "title": "机器人测试",
            "type": "group",
            "all_members_are_administrators": false
        },
        "date": 1536787353,
        "text": "/update@YoutubeChannelsBot",
        "entities": [
            {
                "offset": 0,
                "length": 26,
                "type": "bot_command"
            }
        ]
    }
}

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注