protected static function detectType(array $data)
    {
        foreach ([
                     self::TYPE_TEXT,
                     self::TYPE_AUDIO,
                     self::TYPE_DOCUMENT,
                     self::TYPE_GAME,
                     self::TYPE_PHOTO,
                     self::TYPE_STICKER,
                     self::TYPE_VIDEO,
                     self::TYPE_VOICE,
                     self::TYPE_CONTACT,
                     self::TYPE_LOCATION,
                     self::TYPE_VENUE,
                     self::TYPE_VIDEO_NOTE,
                     self::TYPE_NEW_CHAT_MEMBERS,
                     self::TYPE_LEFT_CHAT_MEMBER,
                     self::TYPE_NEW_CHAT_TITLE,
                     self::TYPE_NEW_CHAT_PHOTO,
                     self::TYPE_DELETE_CHAT_PHOTO,
                     self::TYPE_GROUP_CHAT_CREATED,
                     self::TYPE_SUPERGROUP_CHAT_CREATED,
                     self::TYPE_CHANNEL_CHAT_CREATED,
                     self::TYPE_MESSAGE_PINNED,
                     self::TYPE_INVOICE,
                     self::TYPE_SUCCESSFUL_PAYMENT,
                 ] as $type) {
            if (isset($data[$type])) {
                return $type;
            }
        }
        return static::TYPE_UNKNOWN;
    }